【发布时间】:2012-06-21 14:04:39
【问题描述】:
请帮我解决一个 css 边距的小问题。
HTML:
<body>
<div id="wrapper">
<div id="content"></div>
</div>
</body>
CSS:
* { margin:0; padding:0; }
body {
background-image: url('/images/pat_1.gif');
background-repeat: repeat;
}
#wrapper {
background-color: #fff;
margin: 0 auto;
width: 960px;
}
#content {
background-color: #fff;
margin: 0 -50px;
}
在#content 内部有很多带有width: 960px; 的div。我在这里写的是负边距,因为我的#wrapper 的两边都需要一个空格(background-color: #fff;)。一切都很好,直到我将浏览器的窗口大小调整为 960 像素 - 主要问题是窗口边框的右负边距不会消失,它不会像左边距一样隐藏。
我已经尝试过overflow: hidden,但没有帮助。
感谢您的建议
【问题讨论】: