我正在嘗試使我的導航菜單li項目寬度與頁面自動調整大小。這意味着,如果有4個標籤,則4個標籤應該將自己劃分爲屏幕寬度,並且相等。我試着用汽車和100%,但什麼也沒有工作:(導航鋰標籤的自動寬度
<div class="headercss">
<div class="headerlogo">
</div>
<div class="nav">
<ul>
<li><a href="#home"> <br>BLINK</a></li>
<li><a href="#news"><br>ADVERTISING WITH BLINK</a></li>
<li><a href="#contact"><br>EDUCATING WITH BLINK</a></li>
<li><a href="#about"><br>ABOUT US</a></li>
</ul>
</div>
</div>
/* BODY */
body {
margin: 0px;
background-color: #000000;
}
/* 1. HEADER */
.headercss {
width: auto;
height: 500px;
background-color: #000000;
border: 1px dashed #ffffff;
position: relative;
}
.headerlogo {
width: 980px;
height: 250px;
background-color: #272727;
border: 1px dashed #ffffff;
position: relative;
left: 50%;
margin-left: -490px;
}
.nav {
width: 980px;
height: 70px;
background-color: #272727;
border: 1px dashed #ffffff;
position: relative;
left: 50%;
margin-left: -490px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
a:link, a:visited {
display: block;
height: 68px;
width: 244px;
font-size: 12px;
color: #FFFFFF;
border-right: 1px solid #000000;
background-color: #272727;
text-align: center;
text-decoration: none;
font-family: 'Raleway', Arial;
letter-spacing: 2pt;
line-height: 200%;
}
a:hover, a:active {
background-color: #242424;
}
太棒了!非常感謝,讓它對一個:link,a:visited!進行了一些小調整。 – Pierre 2015-02-11 09:28:28