Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-07-2006, 07:12 AM #1
- Join Date
- May 2006
- Thanked 0 Times in 0 Posts
difference b/w id & class selectors?
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, 07:42 AM #2
- Join Date
- Mar 2006
- Splendora, Texas, United States of America
- Thanked 276 Times in 270 Posts
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>
For every complex problem, there is an answer that is clear, simple, and wrong.