【发布时间】:2022-08-09 11:34:16
【问题描述】:
样式化 css 与少.js预处理器我有类似的东西:
a,a:hover,a:focus,a:active,a:link,a:visited {
text-decoration: hsl(46, 27%, 5%);
font-weight: inherit;
... <other props>
border-bottom: 1px solid hsl(200, 99%, 10%);
}
是否可以使用 Less 将上面的整个块包装在某种类、函数、规则集或变量中,并在需要时在其他任何地方使用它(在其他类、样式、选择器、标签中)?
例如,希望类似:
.myHrefStyle() {
a,a:hover,...{
text-decoration: hsl(46, 27%, 5%);
...
border-bottom: 1px solid hsl(200, 99%, 10%);
}
}
然后在其他地方重用它:
.otherClass {
.myHrefStyle()
}
-
我想这就是你想要的lesscss.org/features/#mixins-feature