這種佈局幾乎在網絡上隨處可見,但似乎沒有人提供任何有關其工作原理的信息。我需要將內容居中,並且背景需要擴展頁面的整個寬度示例http://www.fuerstlaw.com/(藍色bg顏色擴展了整個寬度)。這是如何使用CSS完成的?我覺得這是非常簡單的事情,但無法解決。如何將內容居中並將背景顏色擴展至頁面的100%?
這裏是我的代碼,我只是想以頭在這個環節的工作,至少到達現場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>
非常感謝您的回覆!這工作! –