user1175969 user1175969 - 1 year ago 58
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download