我的網站上的頂欄並未完全改變顏色......底部有一條條。有誰知道爲什麼?我的website和error。我的代碼:我的頂級酒吧沒有完全填充
HTML
<header>
<ul>
<li> <a href="/">Home</a></li>
<li> <a href="https://github.com/reteps" >Github</a></li>
<li> <a href="gradecalc/gradecalc.html" >Grade Calculator</a></li>
</ul>
</header>
CSS上ul
標籤
header ul { /*selects list of stuff*/
list-style-type: none; /*no bullet points*/
margin: 0;
padding: 0;
background-color: #70deef;
position: fixed;
width: 100%;
height: 50px;
}
header li { /*selects list element*/
float: left; /*move to left*/
}
header li a {
display: block; /*makes a square*/
color: #ffffff; /*white*/
text-align: center;
text-decoration: none;
padding: 20px 20px 10px;
}
header li a:hover {
background-color: #d6d6d6; /*grey*/
}
你'ul'有50高度的孩子'li'的只是作爲文本和填充一樣高。刪除'ul'高度。 –
我應該把高度放在'li'標籤內嗎? – lol
只需從'ul'類刪除高度。讓填充和文本高度控制標題高度。 –