发现这样写,背景和文字都变成了透明色。导致文字展示模糊。背景也不能完全透明。接下来使用了网上的各种方法:.regional_table /deep/ .el-table, .el-table__expanded-cell { background-col_el-table背景透明">
当前位置:   article > 正文

el-table背景颜色变成透明_el-table背景透明

el-table背景透明

总结一次element ui中el-table的背景颜色变成透明的问题


刚开始使用了opacity=0.5

<el-table style="opacity=0.5;width="100%"></el-table>
  • 1

发现这样写,背景和文字都变成了透明色。导致文字展示模糊。背景也不能完全透明。

接下来使用了网上的各种方法:

.regional_table /deep/ .el-table,
  .el-table__expanded-cell {
    background-color: transparent;
  }
  .regional_table /deep/ .el-table th {
    background-color: transparent !important;
    border-bottom: 1px solid #5078fc;
    color: #fefefe;
  }
  .regional_table /deep/ .el-table tr {
    background-color: transparent !important;
  }
  .regional_table /deep/ .el-table--enable-row-transition .el-table__body td,
  /deep/.el-table .cell {
    background-color: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /deep/.el-table th>.cell {
    color:rgba(254,254,254,1);
    font-weight: 700;
  }
  .el-table::before {
    //去除底部白线
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0px;
  }



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

又比如:

<style lang="less" scoped>
 .table-wrapper /deep/ .el-table--fit{
        padding: 20px;
}
 .table-wrapper /deep/  .el-table, .el-table__expanded-cell {
    background-color: transparent;
}

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

</style>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

发现效果都不行,/deep/会报错,接着把/deep/改成>>>或者::v-deep就可以编译成功了。但是效果并没有使得背景变透明,也不知道是不是我自己用的style样式是scss的原因。

接着我使用了一个可以变透明效果的方法:

图片展示:

在这里插入图片描述
代码是:
style样式添加以下代码

/*最外层透明*/
::v-deep .el-table,
::v-deep .el-table__expanded-cell {
  background-color: transparent !important;
}
/* 表格内背景颜色 */
::v-deep .el-table th,
::v-deep .el-table tr,
::v-deep .el-table td {
  background-color: transparent !important;
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

改变表头和表里字体的颜色属性:

<el-table 
      :cell-style="{ color: '#fff' }"
      :header-cell-style="{ color: '#fff' }">
</el-table>
  • 1
  • 2
  • 3
  • 4

就ok啦。我的有效果了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/113771
推荐阅读
相关标签
  

闽ICP备14008679号