我的 wrapper 是 1000 像素。我怎样才能让我的导航栏和页脚成为整个页面?如果尝试从包装器中取出导航和页脚,则不会居中。
<html>
<head>
<meta charset="utf-8"/>
<title>
</title>
</head>
<body>
<div id="wrapper">
</div>
</body>
</html>
CSS
*{
margin:0px;
padding:0px;
list-style-type:none;
}
body
{
background:white;
text-align:center;
font-family:Arial;
font-size:12px;
}
#wrapper
{
width:1000px;
margin:2px auto 2px auto;
text-align:left;
}
最佳答案
将 nav 和 footer 放在 wrapper 之外。和:
#wrapper
{
width:1000px;
margin:2px auto 2px auto;
}
footer, #footer, .footer, nav .nav, #nav /* etc - whatever you're using */ {
width:100%;
text-align: center;
}
如果您希望所有内容都集中在这些区域中,而不仅仅是文本。将 #wrapper 更改为类而不是 id ( .wrapper ),然后添加到页脚或导航栏中。例如
<footer>
<div class='wrapper'>
<!-- content here -->
</div>
</footer>
希望这能回答您的问题,因为它有点不清楚。
关于html - 如何让 nav 和 footer 超过 1000px?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18795632/