想过用last-child但但兼容性有问题,所以放弃,大家有没有更简单的方法?
总共想了如下几个方法,自己挑着用
1,
.wrap_title li a:not(:first-child){
background:url("line.png") no-repeat left center;
}
2,
.wrap_title li a:not(:last-child){
background:url("line.png") no-repeat right center;
}
3,
.wrap_title li a{
background:url("line.png") no-repeat right center;
}
.wrap_title li a:last-child{
background:none;
}
4,
.wrap_title li a{
background:url("line.png") no-repeat left center;
}
.wrap_title li a:first-child{
background:none;
}
5,
给最后一个设置class,比如last-item
.last-item{
background:none;
}
10 回答11.6k 阅读
2 回答3.1k 阅读✓ 已解决
2 回答4.1k 阅读✓ 已解决
5 回答2.2k 阅读
3 回答2.7k 阅读✓ 已解决
3 回答1.8k 阅读✓ 已解决
2 回答1.7k 阅读✓ 已解决
既然都想到了
last-child
了,那就换一个思路。既然last-child
有兼容性,但是first-child
没有兼容性啊!所以,这里可以把a
的background
都换成left center
,然后用first-child
的background:none
.wrap-title
设置margin-right: -1px;