100% DIV 宽度并不是真正的 100% [英] 100% DIV width is not really 100%
问题描述
当我有一个
width: 100%
时,它并不是真正的 100%:testtesttesttesttest...#div {宽度:100%;背景颜色:红色;}
现在当你调整窗口大小时,会有一个水平滚动条,你向右滚动,然后背景消失了.在这种情况下,我如何保留背景?
在这里您可以看到问题的实际情况:http://beta.ovoweb.net/?i=3
现在,当您调整窗口大小并向右滚动时,您将无法再看到背景.如何解决这个问题?
100% 值是父级宽度或视口的 100%.请参阅文档.
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?
The 100% value is 100% of the parent's width or the view port. See the documentation.
这篇关于100% DIV 宽度并不是真正的 100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!