user1175969 user1175969 - 11 months ago 30
CSS Question

Combine multiple existing classes into a single class

I currently have a lot of buttons in various views with the following classes applied

class="btn btn-primary btn-sm custom"
. How do I include
"btn btn-primary btn-sm"
in my CSS so that I can just use the single class rather than specifying each separately?


LESS supports mixins, but you will have to import the bootstrap.less file first.

For a mixin, the syntax is:

.custom {

For info on importing bootstrap.less as just a reference for your mixins, see Reference a class/mixin without completely importing the LESS file