gpt4 book ai didi

css - 可以嵌套 CSS 点运算符吗?

转载 作者:太空宇宙 更新时间:2023-11-03 22:39:51 25 4
gpt4 key购买 nike

我有一个 CSS 样式表如下:

.commandsTable {
color: whitesmoke;
background-color: black;
margin-left: auto;
margin-right: auto;
}

.commandsTable td {
background-color: #039be5;
}

.commandsTable tr:hover {
background-color: black;
}

正如您所看到的,'.commands table' 重复了两次以分别设置 td 和 tr 元素的样式。

所以...

有没有办法在 CSS 中嵌套点 (.) 运算符以防止重复输入代码?

最佳答案

您只能使用像 sass 这样的预处理器来做到这一点

在纯CSS中你不能嵌套元素

关于css - 可以嵌套 CSS 点运算符吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44503648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com