我有一个带有背景图片的宽 div。 div 的宽度为 1100 像素,当浏览器窗口小于该宽度时,会出现滚动条。有什么办法可以避免滚动条吗?那不是任何黑客。现在我知道我可以把它放在 body image 中,但出于某种原因我想把它放在这个 div 中。
<body>
<div id="imgWrapper"> <-the wide div the image
<div id="wrapper"> <- normal 960px wrapper
<div id="content"> <- content inside this
Blablabla......
</div>
</div>
</body>
当然,如果 #container/#content 中的内容比浏览器窗口宽,那么我想要滚动条。
最佳答案
使用overflow:hidden
或overflow:auto
。
每个轴也有变体,overflow-x:
和 overflow-y:
具有相同的属性(hidden
,可见
,和自动
)。
关于html - 宽 div - 我能以某种方式摆脱滚动条吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4222542/