B2B Articles
July 08, 2010
By:Ironpaper

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 reused and recycled.

Interested in working for or partnering with Ironpaper? We’d love to hear from you.
We are passionate about helping remarkable companies grow. We solve challenges that hold businesses back. We love it. 
Connect with Us