border-left
上的边框底部覆盖,因此在边框左下方看起来像是弯曲的。为什么border-bottom
获得偏好并覆盖左边的任何答案?
HTML
<ul>
<li>list 1</li>
<li class="selected">list 1</li>
<li>list 1</li>
<li>list 1</li>
</ul>
CSS
ul {
list-style:none
}
li {
width:300px;
padding:10px;
height:50px;
background:#ddd;
border-bottom:1px solid #333;
}
li.selected {
border-left:4px solid #f00;
}
JSFiddle :http://jsfiddle.net/HarishBoke/8VC2c/1/
答案 0 :(得分:3)
使用before
伪元素
li.selected {
background:rgb(246, 246, 246);
position: relative;
}
.selected:before {
content: "";
width: 4px;
height: 100%;
position: absolute;
left: 0;
top: 0;
background: #f00;
}
答案 1 :(得分:1)
borders
中{p} css
彼此对角相交,所以只有使用borders
才能实现这一点,请检查此问题是否正确... Can I have different colored left and top borders in CSS with straight join?
答案 2 :(得分:0)
规则未被覆盖,您的问题是没有可视化与背景颜色相同的1px边框!
例如,更改border-bottom:4px solid #66E710;
示例:http://jsfiddle.net/8VC2c/3/
希望它有所帮助!