@mixin rounded-corner {}@mixin corner {}@mixin button-effective {}.button { @include .rounded-corner; @include .corner; @include .button-effective // Continue with other classes.}编译为:.button { /* rounded-corner styles here */ /* corner styles here */ /* button-effective styles here */}没有 LESS与SASS具有相似的特征,也具有 extend 和 mixin ,但是如果您想向另一类添加样式,则LESS会更宽容一些.尽管我认为LESS仍然被认为是mixin,但是您可以像下面这样将一个类样式添加到另一个类样式中,而不必使用关键字.LESSLESS has a similar sytanx to SASS and also has extend and mixin, though LESS is a little more forgiving if you want to add one class' style to another. While I believe still considered a mixin in LESS, you can add one class style to another like the following without having to use a keyword..rounded-corner {}.corner {}.button-effective {}.button { .rounded-corner; .corner; .button-effective; // Continue with other classes.}编译为:.button { /* rounded-corner styles here */ /* corner styles here */ /* button-effective styles here */} 这篇关于如何用另一种样式扩展CSS类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 04:00