这种布局几乎在网上无处不在,但似乎没有人提供任何有关它的信息。我需要将内容居中,并且背景需要延伸到整个页面宽度。例如http://www.fuerstlaw.com/ (蓝色背景颜色延伸到整个宽度)。如何使用CSS实现这个效果?我感觉这是非常简单的事情,但就是想不出来。
这是我的代码,我只是希望至少让头部在这个测试页面链接http://gsringolaw.com/home中可以正常工作。
这是我的代码,我只是希望至少让头部在这个测试页面链接http://gsringolaw.com/home中可以正常工作。
body {
margin: 0;
padding: 0;
}
#wrapper {
width: 960px;
margin: 0 auto;
}
#masthead {
min-width: 100%;
margin: 0px;
padding: 0px;
background-position: 0px 0px;
background-color: #00304F;
position: relative;
z-index: 0;
}
#headertext {
position: relative;
width: 250px;
height: 82px;
font-family: Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
font-size: large;
top: -41px;
left: 704px;
}
#glow {
height: 170px;
background-image: url('images/glow.png');
position: relative;
background-repeat: no-repeat;
background-position: center;
top: -192px;
left: -13px;
width: 973px;
}
#logo {
position: relative;
background-image: url('images/gayleringo.png');
background-repeat: no-repeat;
width: 528px;
height: 113px;
top: 28px;
left: 0px;
}
<div id="wrapper">
<div id="masthead" style="height: 171px">
<div id="logo">
</div>
<div id="headertext" class="auto-style1">
Louisiana: 504-975-0180<br />
<br />
Florida: 850-292-7059</div>
<div id="glow">
</div>
</div>
<div id="top_nav">
</div>
<div id="container">
<div id="right_col">
</div>
<div id="page_content">
</div>
</div>
<div id="footer">
</div>
</div>