Web前端笔记-修改element ui中表格样式(透明、去横纵线等含修改思路)

160 篇文章 8 订阅
32 篇文章 3 订阅

官方效果是这样的:

此处改成了这样的效果:

此处是可以进行滑动的,就是去除了滑动条,仍能滑动的效果。

下面说下修改样式,找到使用el-table的vue组建:

在style中贴上:

<style>

  table-wrapper /deep/ .el-table--fit{
    padding: 20px !important;
    border: none !important;
  }

  .table-wrapper .el-table, .el-table__expanded-cell {
    background-color: transparent !important;
    border: none !important;
  }

  .table-wrapper /deep/ .el-table tr {
    background-color: transparent !important;
    border: none;
  }

  .el-table /deep/  .el-table--enable-row-transition .el-table__body td, .el-table .cell{
    background-color: transparent !important;
    border: none;
  }

  /*表中数据的颜色及背景等*/
  .el-table th, .el-table tr {
    border: 0!important;
    background-color: transparent!important;
    color: white !important;
  }

  /*去每一行记录下的横线*/
  .el-table--border tr,td{
    border: none!important;
  }

  /*去最下面的横线*/
  .el-table::before{
    height:0;
  }

  /*table内的高亮*/
  .el-table tbody tr:hover>td {
    background-color:rgb(79, 163, 213)!important
  }

</style>

这里在style上不能加scope。

然后在组建外面套一个div在其class上使用table-wrapper:

此处修改样式的逻辑是直接F12,打开开发者工具:

那个css影响了就改哪一个。

修改了的css要使用!important;避免被覆盖。通过这种方式去改element ui中的默认样式。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT1995

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值