我对不同的 4 个类具有相同的属性。所以我想减少代码重量。那么我怎样才能把它作为一个单一的公共(public)类。
.iass-general-config-wrapper h2
{
padding-bottom: 1px!important;
}
.iass-workload-config-wrapper h2
{
padding-bottom: 1px!important;
}
.iass-network-config-wrapper h2
{
padding-bottom: 1px!important;
}
.vdi-review-wrapper
{
padding-bottom: 1px!important;
}
最佳答案
您可以将它们“合并”在一起作为多选择器规则
.iass-general-config-wrapper h2,
.iass-workload-config-wrapper h2,
.iass-network-config-wrapper h2,
.vdi-review-wrapper
{
padding-bottom: 1px!important;
}
或者如评论中所述,您可以简单地创建一个新类并应用它,从而减少代码量
.padding-bottom
{
padding-bottom: 1px !important;
}
关于css - 如何将多个 css 类属性合并到一个类中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28320288/