Assign Two CSS Classes Together For One Object

It is possible to assign an object two or more classes at the same time. WordPress does this out of the box for images, for example.

<img class=”alignnone size-full wp-image-144

We used color coding of each class to detail each class applied to the image tag. To add multiple classes, simply separate each class with a space (not a comma). In the case above, the image will use the rules for both “alignnone” and “size-full” as well as “wp-image-144.”

This can be useful if you are using a CSS grid framework or if you have created your own CSS primer style sheet, which requires further customization. It will allow you to leave the framework untouched, while you can add further specifications or style to the second class. This way, classes can be re-used and recycled.

Follow Ironpaper to receive new insights on B2B marketing and sales.

* Your privacy is important to us.

Ironpaper is a B2B marketing agency and lead generation agency. Ironpaper integrates design, technology and marketing for the web to drive meaningful results for clients. We are based in New York City and Charlotte, NC.