With my list of html style class continues to grow, like:
<button type="button" class="btn btn-default btn-sm ...">
</button>
I wonder whether there is an easier way to represent this list, like:
.list_of_css = "btn"+ "btn btn-default"+"btn-sm"+...
So I can simply use:
<button type="button" class="list_of_css">
</button>
I recommend using a CSS pre-processor as suggested by j08691. I specifically recommend using Sass.
Sass inheritance example:
.fancy-button{
@extend .btn, .btn-default, .btn-sm;
}
HTML as expected:
<button type="button" class="fancy-button">Fancy Button</button>
Sass: http://sass-lang.com/
Sass Inheritance: http://sass-lang.com/guide#topic-7
What Nobody Told You About Sass’s @extend: http://www.sitepoint.com/sass-extend-nobody-told-you/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With