I often get questioned as to what the difference is between class tags vs ID tags in CSS. It's actually quite simple, and many people over think it. ID tags can only be used *once* on a web page, whereas class tags can be used multiple times on a webpage. ID tags are typically used on DIV tags that layout a webpage, as they'll only be required once. Class tags are used on things such as text, table parameters, etc.
To setup a class tag, you would do the following on your CSS stylesheet.
.classname {
parameter:value;
}
To setup an ID tag, you would do the following in your CSS stylesheet.
#idname {
parameter:value;
}
Notice the difference is the pound sign (#) on ID's, and the period on classes.
Now, on your webpage, when you want an asset on your page to have an ID tag associated with it, you would do something like the following : <div id="id_name">Test!</div>. Just like ID's, when you want to specify a class you would write the following : <div class="class_name">Test!</div>.
Find this article helpful?
Consider becoming a fan of our Facebook page! The link is in our fan box on the left!
