开始和结束一段CSS代码

Nav*_*yar 0 css

当我使用样式CSS时,如下所示:

#test p{/*css code here*/}
#test span{/*css code here*/}
#test p.one{/*css code here*/}
#test span.test{/*css code here*/}
Run Code Online (Sandbox Code Playgroud)

然后#test每次选择带有id的div 更容易,如下所示:

begin #test
p{/*css code here*/}
span{/*css code here*/}
p.one{/*css code here*/}
span.test{/*css code here*/}
end #test
Run Code Online (Sandbox Code Playgroud)

这是CSS样式的好习惯吗?如果是这样,我希望这将被添加到CSS的未来版本中.

kee*_*eeg 6

或者您可以使用动态CSS语言,例如LESS:http://lesscss.org/ OR Sass http://sass-lang.com/ as @steveax指出

  • 或[Sass](http://sass-lang.com/) (3认同)