這篇文章給大家分享的是有關Css如何實現導航欄的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
一、垂直導航欄
ul{
list-style-type: none;
margin: 0px;
padding: 0px;
}
a:link,a:visited{
text-decoration: none;
display: block;
background-color: aqua;
color: black;
width: 50px;
text-align: center;
}
a:active,a:hover{
background-color: crimson;
}<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>導航欄</title> <link href="style.css" type="text/css" rel="stylesheet"> </head> <body> <ul> <li><a href="#">導航1</a></li> <li><a href="#">導航2</a></li> <li><a href="#">導航3</a></li> <li><a href="#">導航4</a></li> </ul> </body> </html>
二、水平導航欄
ul{
list-style-type: none;
margin: 0px;
padding: 0px;
background-color: aqua;
width: 250px;
text-align: center;
}
a:link,a:visited{
font-weight: bold;
text-decoration: none;
background-color: aqua;
color: black;
width: 50px;
text-align: center;
}
a:active,a:hover{
background-color: crimson;
}
li{
display: inline;
padding-left: 5px;
padding-right: 5px;
}感謝各位的閱讀!關于“Css如何實現導航欄”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。