Html li 元素的下边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12354456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bottom border on li element
提问by oliverbj
I am trying to add a bottom border to my li elements. This is my css:
我正在尝试为我的 li 元素添加一个底部边框。这是我的CSS:
.menu{
text-align:right;
}
.menu li{
padding:5px;
text-transform: uppercase;
display:inline;
list-style-type:none;
list-style-position: inside;
border-bottom: 1px solid red;
}
And my HTML:
还有我的 HTML:
<div class="menu">
<ul>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Testimonials</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
</div>
For some reason, no bottom border is added. I can add a border to the right and left, but not the bottom. What am I doing wrong?
出于某种原因,没有添加底部边框。我可以在左右两侧添加边框,但不能在底部添加边框。我究竟做错了什么?
采纳答案by blasteralfred Ψ
回答by Web Designer cum Promoter
I understand clearly about your need. the solutions is given below just change bottom as right. please test and give feedback.
我清楚地了解您的需求。下面给出了解决方案,只需更改底部即可。请测试并提供反馈。
.menu li{
padding:5px;
text-transform: uppercase;
display:inline;
list-style-type:none;
list-style-position: inside;
border-right: 1px solid red;
}