我有一个带有以下一组 w3.css 类的按钮:
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<button class="w3-btn w3-lime w3-hover-green w3-round-large w3-border w3-border-green w3-ripple">Button</button>
这将是我整个网站的共同主题。而不是在每个按钮上写下所有这些类的列表,我如何才能将这组类放入一个类 mybuttonclass
中,例如:
<button class="mybuttonclass">Button</button>
最佳答案
您熟悉 LESS 等 CSS 预编译器吗?你可以做一个类的类。看起来像:
.mybuttonclass {
.w3-btn;
.w3-lime;
.w3-hover-green;
.w3-round-large;
.w3-border;
.w3-border-green;
.w3-ripple;
}
否则,您将不得不手动将所有 CSS 属性复制到一个类中。
关于html - Html 中的多类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39413689/