elementUI el-tabs 样式

本文展示了如何使用CSS对elementUI的el-tabs组件进行样式定制,包括设置选项卡的字体、颜色、宽度、对齐方式以及选中状态和鼠标悬停时的效果。同时,通过调整popper-append-to-body属性避免样式污染,并移除了翻页箭头和顶部边框。

elementUI el-tabs 样式

<el-tabs v-model="activeName" @tab-click="handleClick" :stretch="true"
         :popper-append-to-body="false" class="div-tabs">

:stretch="true"设置选项卡自定义撑开样式
:popper-append-to-body=“false” 在#app内部使用,用于单个页面的设置,不污染其他样式

在这里插入图片描述

/deep/ .div-tabs{
    //选择的内容样式
    .el-tabs__item{
      color: #666;
      font-size: 0.83vw;
      width: 5vw;
      padding: 0;
      font-family: PingFang-SC-Medium;
      text-align: center;
    }
     //选中的样式
    .el-tabs__item.is-active{
      color: #333;
      font-size: 0.83vw;
      font-family: PingFang-SC-Medium;
    }
    //鼠标放上去的样式
    .el-tabs__item:hover {
       color: #1da27c;
     }
     //选中的底部线条样式
    .el-tabs__active-bar{
       background-color:#2F5E96;
       width: 5vw !important;
     }
     //未选中底部灰色线条样式
    .el-tabs__nav-wrap::after {
      background-color:#D9D9D9;
    }
  //文字及tabs居中显示
   .el-tabs__nav-scroll{
     display: flex;
     justify-content: center;
     margin:0 auto
   }
   //去掉两边翻页箭头
   .el-tabs__nav-next, .el-tabs__nav-prev {
     display: none;
   }
    //去除顶部线
    .el-tabs--card>.el-tabs__header .el-tabs__nav {
     border: none;
    }
  }
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值