设置了一个带有 overflow: scroll 的 div,但尽管我将 div 的宽度设置为 100%,但我的内容超出了页面的一侧。
#main {
background: #ccc;
height: 100%;
overflow: auto;
margin-top: -8px;
z-index: 1000;
padding-top: 4px;
float: right;
width: 100%;
min-height: 100%;
}
#main #chat {
padding-top: -1px;
padding-left: 0px;
margin-left: 210px;
height: 100%;
width: auto;
float: right;
min-height: 100%;
}
我该如何排序?
最佳答案
您已为 body
设置了 100% 的宽度,因此它将拉伸(stretch) 100% 的屏幕,不包括填充和边距。您的浏览器为 body
提供了默认边距:
(我在chrome中是8px)所以你body的宽度是100%+left margin+right margin,当然是100%以上;
给你的 body 一个零边际,你会很好:
body{
min-width: 100%;
height: auto;
font-family: Tahoma, Helvetica;
margin: 0;
}
关于css - 溢出:滚动 - 侧滚动关闭页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19542081/