谷歌新版浏览器89版本less样式穿透(/deep/)失效

项目场景:

使用到antd,用/deep/修改antd原本的样式,今天测试人员更新了谷歌版本(89.0.4389.82),样式失效,直接退回原来的样式

在这里插入图片描述

问题描述:

样式穿透写法如下(仅几例,.antd-tableS是自写的外部容器):
.antd-tableS /deep/ .ant-table-tbody > tr > td {
border-bottom: 1px solid #065370;
border-right: 1px solid #065370;
color: #fff;
}
.antd-tableS /deep/ .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td,
.antd-tableS /deep/ .ant-table-tbody .ant-table-row-hover,
.antd-tableS /deep/ .ant-table-tbody .ant-table-row-hover > td {
background: rgba(37, 83, 255, 0.2) !important;
}

原因分析:

发现不管如何使用/deep/,>>>,!important都无法作用到项目里,且使用开发者工具查看元素是样式表里不显示。

解决方案:

经过一番排查,发现去除/deep/就可以实现效果(在全局使用的情况下不加/deep/,若是scoped,则需加/deep/)
.antd-tableS .ant-table-tbody > tr > td {
border-bottom: 1px solid #065370;
border-right: 1px solid #065370;
color: #fff;
}
.antd-tableS .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td,
.antd-tableS .ant-table-tbody .ant-table-row-hover,
.antd-tableS .ant-table-tbody .ant-table-row-hover > td {
background: rgba(37, 83, 255, 0.2) !important;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值