DIV连接处边框删除掉

我们常常会遇到这种情况,做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;
      }

这样就可以实现如上图的效果啦啦啦啦~~~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值