如何重构某些TD元素的着色?
我正在通过声明来着色特定的TD元素:
td[style*="background-color: #ffc"], td[style*="background-color: #fb9"],
td[style*="background-color: #bfc"], td[style*="background-color: #fcc"] {
background-color: #0d1117 !important;
}
如何重构?
I'm coloring specific td elements by declaring:
td[style*="background-color: #ffc"], td[style*="background-color: #fb9"],
td[style*="background-color: #bfc"], td[style*="background-color: #fcc"] {
background-color: #0d1117 !important;
}
How can I refactor this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CSS中有一个名为
:is
的伪级,使您删除代码重复或者您可以使用
javascript
使用foreach
!它的工作原理:
您有两个变量,
第一个需要一系列十六进制颜色代码。
第二个变量需要您希望将元素颜色的最终颜色。
如何使其在我的项目上工作:
< script>
标签或javascript文件。带有演示的代码片段示例:
there is a pseudo-class in CSS called
:is
that makes you delete the code repetitionor you can use
javascript
by usingforEach
!how it works:
you have two variables,
the first needs an array of hex color codes.
the second variable needs the final color you want the element to be colored.
how to make it work on my project:
<script>
tag or a javascript file.code snippet with demo example: