我们常常会遇到这种情况,做tab页面切换效果时,连接2个div,需要将div连接处的边框删除掉,那么需要怎么处理呢?
我这里左侧tab使用的是ul li,直接上代码(sass),下面是li标签的样式
li {
height: 40px;
line-height: 40px;
padding-left: 20px;
border: 1px solid #DADADA;
border-right: none;
box-sizing: border-box;
&:not(:last-child) {
border-bottom: none;
}
color: #333;
font-weight: 500;
&:focus {
outline: none;
}
@mixin focus {
background-color: #fff;
color: #408ed5;
z-index: 2;
}
&:hover {
@include focus;
}
cursor: pointer;
}
下面是点击的li标签的样式,主要实现代码为添加绝对定位position:relative、z-index:2、border-right:1px solid #fff、margin-right:-1px; content中添加小于li的z-index即可;
.itemClick {
background-color: #fff;
color: #408ed5;
z-index: 2;
position: relative;
border-right: 1px solid #fff;
margin-right: -1px;
}
这样就可以实现如上图的效果啦啦啦啦~~~~