View Full Version : difference b/w id & class selectors?
05-07-2006, 08:12 AM
Does anybody know what's the difference b/w an id selector and a class selector? I know id selector uses (#) in front of it, and class selector uses (.) in front of it, but is the difference in their usage? Thanks!
05-07-2006, 08:42 AM
IDs (identities) are used to identify a single element. Classes (classifications) are used to identify groups of objects. Essentially only one element on a page can have a particular ID while classes can be applied to multiple elements. Think of it like people: there are individual people each with their own unique ID and then there are classes of people, by nation, by school, by occupation, etc.
Example: There can only be one total page container so you might assign that an ID. You might have five data tables and you want all of them to have the same font so you could mark them with the same class.
You can also define multiple classes for an object like so:
<span id="thankyoumessage" class="japanesetext specialcolor">Arigatou!</span>
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.