...
<!DOCTYPE html> <html> <head> <title>導航欄的做法之一</title> <style> /*這是導航條****************************************************************************/ /*容器是用來裝那個存放了a標簽的div*/ .rongqi{ background:#2C323B; height:55px; width:100%; margin:80px 0px; } /*導航條裡面各個a標簽的總寬度,當前是六個a的寬度,每個a寬度預設是200px*/ #top{ //border:solid #fff 1px; margin:0px auto; width:1200px; height:55px; } /*hanghang是a標簽的class*/ .hanghang{ font-size:20px; color:#DDDDDD; text-align:center; line-height:50px; float:left; width:200px; height:55px; margin-left:0px; list-style-type:none; background:#2C323B; text-decoration:none; } .hanghang:hover{ list-style-type:none; color:#ffffff; font-weight:800; background:#0C8ED9; } /*****************************************************************************這是導航條/ </style> </head> <body> <!--這是導航條***************************************************************************--> <div class="rongqi"> <div id="top"> <a class="hanghang" href="#">首頁</a> <a class="hanghang" href="#">導航1</a> <a class="hanghang" href="#">導航2</a> <a class="hanghang" href="#">導航3</a> <a class="hanghang" href="#">導航4</a> <a class="hanghang" href="#">導航5</a> </div> </div> <!--***************************************************************************這是導航條--> </body> </html>