A
A
Alexander Sinitsyn2015-10-31 00:59:24
HTML
Alexander Sinitsyn, 2015-10-31 00:59:24

How to stretch a nested block to the full width of the page?

There is

<div class="block1">
  <div class="block2">
  </div>
</div>

How to stretch block 2 to the entire width of the page, regardless of the properties of block 1?
I tried using the script to set the width equal to body and the negative left indent equal to offset().left of block 2, but when resizing, the indent changes haphazardly.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Sinitsyn, 2015-10-31
@a_u_sinitsin

It seems to have worked.
codepen.io/anon/pen/ZbRrwy

C
Cyril Diamandi, 2015-10-31
@tunnelvision

Try this:
jsfiddle.net/pgcjsk7j/2

G
GoodProject, 2015-10-31
@GoodProject

I think that during resizing it can change due to features in browsers, or you need to make a script so that it constantly checks the size during resizing, try resizing and updating the browser, if it worked out, then everything seems to be normal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question