我希望頁腳的寬度能夠拉伸100%的頁面。不過,我已經在HTML文檔的主體上定義了min-width:1000px和max-width:1000px,以幫助創建流暢的佈局。現在,當我創建頁腳將其設置爲最大/最小寬度:100%時,它不會跨越整個頁面,並受限於主體上設置的最小/最大寬度。有沒有一種方法將頁腳的寬度設置爲100%,同時將最小/最大寬度定義爲1000像素的身體?爲HTML和CSS代碼是:頁腳不會伸展到100%寬度
HTML:
<!doctype html>
<html lang="en">
<head>
Some Text
</head>
<body>
<header>
Some Text
</header>
<section class="mainSection">
<article class="mainArticle">
<header>
<h4>Some Text</h4>
</header>
<p>
Some text
</p>
</article>
</section>
<footer>
<section class="footerSection">
<article class="footerArticle">
<p>Some Text</p>
</article>
</section>
</footer>
CSS:
body{
margin:0px auto;
min-width:1000px;
max-width:1000px;
height:auto;
background-color: #97cdcd;
background-size: 5px 5px;
background-image: linear-gradient(rgba(189, 204, 211, .50) 50%, transparent 50%, transparent);
background-image: -webkit-linear-gradient(rgba(189, 204, 211, .50) 50%, transparent 50%, transparent);
background-image: -moz-linear-gradient(rgba(189, 204, 211, .50) 50%, transparent 50%, transparent);
}
body > footer{
margin:0px;
padding:0px;
min-width:100%;
max-width:100%;
background:#ffffff;
height:auto;
}