@width:5000px; @height:300px; @font_size:12px; .textarea { width:@width; height:@height; font-size:@font_size; }
名称变量(选择器或属性名)
@width:5000px; @height:300px; @font_size:12px; @name:.text; @b_c:border-color; .textarea { width:@width; height:@height; font-size:@font_size; } @{name} { @{b_c}: aqua; }
div{ @val: 0.20rem; width: calc(~”100% - @{val}”); } 编译成: div { width: calc(100% - 0.2rem); }
.bordered { border-top: dotted 1px black; border-bottom: solid 2px black; } //引用使用 #menu a { color: #111; .bordered(); } .post a { color: red; .bordered(); }
.van-cell { background-color: #007bff; color: white; &::after { display: none; } .avatar { width: 60px; height: 60px; background-color: #fff; border-radius: 50%; margin-right: 10px; } .username { font-size: 14px; font-weight: bold; } }
<style> span{ background: yellow; } span:hover::before{ content:"duang"; } </style> <span>222</span>
参考文章:https://blog.csdn.net/weixin_49115895/article/details/108683791