gpt4 book ai didi

CSS继承,或类似的东西

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

这可能是个愚蠢的问题,但就是这样。

我的 css 文件中有 3 个 ID,它们都有一些相同的代码。例如:

#ID1 {
// some code
width: 300px;
height: 300px;
}
#ID2 {
// some code
width: 300px;
height: 300px;
}
#ID3 {
// some code
width: 300px;
height: 300px;
}

我的问题是:是否可以在 CSS 中创建一些类或 ID,然后在另一个 CSS 类或 ID 中调用它。例如:

#setting {
width: 300px;
height: 300px;
}
#ID1 {
.setting
// some code
}
#ID2 {
.setting
// some code
}
#ID3 {
.setting
// some code
}

谢谢。

最佳答案

你正在寻找的东西叫做 LESS。了解一下 here

关于CSS继承,或类似的东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15630779/

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