100%DIV宽度不是真的100% [英] 100% DIV width is not really 100%

查看:123
本文介绍了100%DIV宽度不是真的100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有一个< div> width: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?

在这里你可以看到操作中的问题:
http://beta.ovoweb.net/?i=3

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?

推荐答案

100%的值是父宽度或视图端口的100%。请参阅文档

The 100% value is 100% of the parent's width or the view port. See the documentation.

这篇关于100%DIV宽度不是真的100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆