CSS trick - how to use two classes on a single DOM object - Digital Tool Factory blog CSS trick - how to use two classes on a single DOM object - Digital Tool Factory blog

CSS trick – how to use two classes on a single DOM object

I have no idea how this trick has eluded me for so long, but it is possible to use two classes on the same DOM object.  For example to combine a class called “TopNav” and a class called “SelectedNav” all you have to do is call them both with code like this

<div id=”HomeNavItem” class=”TopNav SelectedNav”>Home</div>

In other words, you’re just putting them in the same class declaration.  I’ve been doing this for years and I’ve never done that before.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog

 

Written By Steve French

 

2 responses to “CSS trick – how to use two classes on a single DOM object”

  1. This is really an important feature of CSS, good to have come across it here.
    Even though this important information is accompanied by a meaningful sentence like “I’ve been doing this for years and I’ve never done that before.”

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.