Quick Tip: Multiple Classes

Sometimes it’s necessary for an HTML element to have two, three, or even four + classes assigned to it. To assign multiple classes to an element, all you need to do is separate them with a space, like this:

  1. <div class="class-one class-two class-three"></div>

In your CSS, you can easily select one or all of these classes. To select some or all of the classes, makes sure you string them together using periods (.) with no spaces in between:

Join us in our newest publication:
  1. .class-one.class-three{
  2.   font-size: 12px;
  3. }

Share and Enjoy !

0 0