我需要 div 栏占据屏幕的整个宽度。我试过使用 width:1920px; 但是如果我改变我的屏幕资源,它会给它一个滚动条。我也试过 width:100%; 但这也没有用!
CSS
#bar {
background: white;
font-family: Designio;
margin-top: -76px;
position: absoulte;
top: 115px;
padding: 15px;
height: 60px;
width: 1930px;
margin-left: -600px;
background-size: 100%;
}
body {
min-width: 768px;
margin: 0px;
background: #0e6585;
font-size: 40px;
}
img.top {
display: block;
margin-left: auto;
margin-right: auto;
}
#container {
height: 768px;
background: #0e6585;
font-family: Designio
}
#inner {
text-decoration: none;
box-shadow: inset 1px 1px 10px 2px #fff;
border-radius: 50px;
margin: 0 auto;
margin-top: 100px;
width: 800px;
height: 600px;
background: #0e6585;
padding: 20px;
color: #946e44;
text-align: center;
}
#nav a.active {
background-color: #0e6586;
color: white;
}
#nav {
height: 10px;
width: 100%;
float: left;
margin: 0 0 1em 0;
padding: 0px;
background-color: white;
margin-top: -10px;
border-bottom: 1px solid white;
}
#nav ul {
list-style: none;
width: 900px;
margin: 0 auto;
padding: 0;
text-align: center
}
#nav li {
float: left;
text-align: center
}
#nav li a {
margin-top: 15px;
display: block;
padding: 8px 15px;
text-decoration: none;
color: #0e6585;
border-right: 1px solid #ccc;
text-align: center
}
#nav li a:hover {
color: #0e6586;
background-color: white;
text-align: center
}
HTML
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="css/Primary.css">
</head>
<body>
<div id="container">
<div id="inner">
<div style="margin-top: -120px">
<div id ="bar">
<div id="nav">
<ul>
<li>
<li>
<a href="home.html" class="active">Home</a>
</li>
<li>
<a href="#">About</a>
</li>
<li>
<a href="#">Graphics</a>
</li>
<li>
<a href="#">Web Design</a>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
</html>