When I have a <div>
with width: 100%
, it is not really 100%:
<div id="div">testtesttesttesttest</div> ... #div { width: 100%; background-color: red; }
Now when you resize the window, so there is a horizontal scrollbar, and you scroll to the right, then the background is vanished. How can I remain the background in this case?
Here you can see the problem in action: http://beta.ovoweb.net/?i=3
Now when you resize the window and scroll to the right, you can't see the background anymore. How to fix this?
There is probably padding on the containing div or body tag.
Answer is No. cause 100 is pixels and 100% is percentage of overall size of page.
No, element width does not include padding, margin, or border.
if you specify width:100%, the element's total width will be 100% of its containing block plus any horizontal margin, padding and border.
The 100% value is 100% of the parent's width or the view port. See the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With