CSS 背景扩展到整个页面宽度
我使用 960 GS 进行网页布局,因此所有内容都以 960 像素宽度居中。然而,我在网格中有一行,我希望背景颜色扩展到页面的整个宽度,而不仅仅是网格的 960 px 宽度。
想想 Envato 处的页脚(尽管我不需要它坚持滚动)。
有什么想法吗?非常感激。
I am using the 960 GS for layout of my webpage, so everything is centred in a 960 px width. However I have a row in the grid that I want the background colour to expand over the entire width of the page and not just the 960 px width of the grid.
Think the footer at Envato (although I don't need it to stick on scrolling).
Any ideas? Would much appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我经常使用960网格,也遇到过这种情况。我通常倾向于做的是从主容器(例如container_12)中分离出来,并在其周围添加一个包装器以实现全宽背景。采取以下示例:
然后我可以简单地将全宽背景应用于#header,而container_12将保持固定宽度并居中。
I use the 960 grid quite a bit and have also come across this scenario. What I generally tend to do is break out from the main container (container_12 for example) and add a wrapper around it to achieve the full width background. Take the following example:
Then I can simply apply the full width background to #header and container_12 will remain fixed width and centered.
我不明白你的意思,因为你的背景取决于用户的显示分辨率,但通常如果你将 html 的宽度和边距设置为自动,无论用户最大化还是输入任何分辨率,它都会在你的页面上划痕,以进行滚动您也可以找到您想要的东西。
希望它能帮助你。
I didn't get what you mean exactly because your background depends on the users display resolution, but generally if you set the width and margine of html to auto it will scratch all over your page wether user maximize or put in any resolution, for scrolling you can also reach what you looking for.
hope it will help you.
我不使用 960GS,但也许这就是您所需要的:
http://gandrweb.com/blog/comments/960-grid-system-full-width-backgrounds
I don't use 960GS, but perhaps this is what you need:
http://gandrweb.com/blog/comments/960-grid-system-full-width-backgrounds