我一直在嘗試2個小時將標題圖片下的導航欄很好地對齊,但它不會這樣做。前4個列表項在一行中對齊,但最後一個在他們下面,+導航欄不像我想要的那樣居中。我到處搜索了答案,沒有任何工作。幫助將不勝感激。 p.s.我是新來的CSS和HTML所以要溫柔。無法對齊標題圖片下的導航欄
<html>
<head>
<style>
body {
background-image: url("http://i.imgur.com/SwKXk23.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
body {
margin: 0;
}
.header {
width: 100%;
height: auto;
background-color: none;
padding-top: 24px;
}
.headerContent {
width: 1024px;
height: auto;
margin: 0 auto;
}
.headerContent a img {
width: 659px;
height: 144px;
margin: 0px auto;
display: block;
}
.nav {
width:750px;
margin:0 auto;
list-style:none;
}
.nav li {
float:left;
}
.nav a {
display:block;
text-align:center;
width:150px; /* fixed width */
text-decoration:none;
}
.nav ul li{
height: 40 px;
background: #A14F53;
}
.nav ul li{
list-style-type: none;
width: 150px;
float: left;
}
.nav ul li a{
text-decoration: none;
color: black;
line-height: 40px;
display: block;
border-right: 1px solid #CCC;
text-align:center;
}
.nav ul li a:hover{
background-color:#F9C1B5;
}
.headerBreak{
width: 100%;
height: o%;
border bottom: 2px solid #128e75;
}
</style>
</head>
<body>
<div class="background">
<div class="header">
<div class="headerContent">
<a href="#">
<img style="border:0;width:900px;height:250px;" alt=""
title="" src="http://i.imgur.com/5NhCbxu.png">
</a>
</div>
<div class="nav">
<ul id="nav">
<li><a href="Pagina principala.html">Pagina principala</a></li>
<li><a href="Despre noi.html">Despre noi</a></li>
<li><a href="Clienţii noştri.html">Clientii nostri</a></li>
<li><a href="Produse.html">Produse</a></li>
<li><a href="Contacte.html">Contacte</a></li>
</ul>
</div>
</div>
<div class="headerBreak"></div>
</div>
</body>
</html>
非常感謝大家! :3 –