DEV Community

Cover image for Question:  Create a new class from existing classes.
GraphiTivity
GraphiTivity

Posted on

Question: Create a new class from existing classes.

This sounds very simple but I have no clue in which direction to go... please advice.

here is an example:

Several classes will make my HTML element for example a button will look like this

<a class="color-red font-2x bg-black"> Button </a>

I want to take the CSS class names and write it in my CSS as below so I can add just one class name.

.myButton = { 
              .color-red
              .font-2x
              .bg-black 
             }

Now my HTML will look like this

<a class="myButton"> Button </a>

I'm creating new CSS Class using existing Class. How to do this?

Top comments (0)