關(guān)于UL添加下邊框的問題
<!DOCTYPE html>
<html>
? ? <head>
? ? ? ? <meta charset="utf-8">
? ? ? ? <title>hello world</title>
? ? ? ? <style type="text/css">
? ? ? ? *{margin:0;padding:0;font-size:14px;}
? ? ? ? ul{list-style:none;border-bottom:5px solid #CC0033;}
? ? ? ? li{float:left;}
? ? ? ? a{text-decoration:none;display:block;height:30px;line-height:30px;background-color:#ccc;margin-bottom:1px;width:100px;text-indent:10px;}
? ? ? ? </style>
? ? </head>
? ? <body>
? ? ? ? <ul>
? ? ? ? ? ? <li><a href="#">首 ? 頁(yè)</a></li>
? ? ? ? ? ? <li><a href="#">新聞快訊</a></li>
? ? ? ? ? ? <li><a href="#">產(chǎn)品展示</a></li>
? ? ? ? ? ? <li><a href="#">售后服務(wù)</a></li>
? ? ? ? ? ? <li><a href="#">聯(lián)系我們</a></li>
? ? ? ? </ul>
? ? </body>
</html>
按照視頻一樣的代碼,為什下邊框的線并沒有出現(xiàn)在導(dǎo)航欄的下方,而是被擠到了右邊去了 ,不應(yīng)該是在《li》處設(shè)置邊框嗎 ?為什么視頻是在《ul》設(shè)置下邊框???
2017-08-16
沒給ul設(shè)置高度。在ul的樣式中添加height:30px即可。