gpt4 book ai didi

css - 如何列出一系列包含相同属性的类并为每个类分配不同的 z-index

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

如何列出一系列包含相同属性的类并为每个类分配不同的 z-index。例如

.class1 .class2 .class3 .class4 {
background color:red;
height:70px;
width:40px;
z-index: 1,2,3,4
}

其中 .class1 的 z-index 为 1,.class2 的 z-index 为 2 等等

最佳答案

这就是我为您所描述的内容所做的。除非你想使用预处理器。你不能用纯 CSS 中的单个声明来完成所有这些。但这几乎就是预处理器无论如何都会编译的结果。

.class1, .class2, .class3, .class4 {
background color: red;
height: 70px;
width: 40px;
z-index: 1;
}

.class2 {
z-index: 2;
}

.class3 {
z-index: 3;
}

.class4 {
z-index: 4;
}

关于css - 如何列出一系列包含相同属性的类并为每个类分配不同的 z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51216871/

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