简体   繁体   English

包装器和容器中的全宽元素

[英]Full width elements within wrapper and container

*This is just a general question prior to the development, hence no code provided. *这只是开发之前的一个普遍问题,因此没有提供代码。

I want a div in the middle of my site to have a background width of 100% in order to go all the way across the screen, but this div is INSIDE the wrapper/container (of which has a 980px width) so it's restricted as normal to the regular content width. 我希望网站中间的div的背景宽度为100%,以便在整个屏幕上都可以通过,但是该div位于包装器/容器(宽度为980像素)的内部,因此将其限制为垂直于常规内容宽度。

How can this happen without ending wrapper and container, creating the full width div, then making a new set of wrapper/container divs? 如何在不结束包装器和容器,创建全宽div,然后制作一组新的包装器/容器div的情况下发生这种情况? As w3 validator states to me I should have these particular div's more than once. 正如w3验证程序向我指出的那样,我应该多次使用这些特定的div。

Im not sure exactly what you want without examples, but you may want to try something like this: 我没有例子就不确定您想要的是什么,但是您可能想要尝试这样的事情:

<style>
#width980{width:980px;height:200px;margin:0 auto;background:#aaa;}
#fullwidth{height:100px;background:#000;position:absolute;left:0;top:50px;right:0;color:#fff;}
</style>
<div id="width980">
    width980
<div id="fullwidth">
    fullwidth
</div>
</div>

Here, I made you a fiddle: http://jsfiddle.net/Wde8W/ 在这里,我为您提供了一个小提琴: http : //jsfiddle.net/Wde8W/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM