Combat Babe
08-07-2004, 09:02 AM
Not really important, but I've noticed that when people are using classes in css some use #name and some use .name. What's the difference, or is it one of those things like .html and .htm?
|
View Full Version : # vs . What's the difference? Combat Babe 08-07-2004, 09:02 AM Not really important, but I've noticed that when people are using classes in css some use #name and some use .name. What's the difference, or is it one of those things like .html and .htm? weird girl 08-07-2004, 09:13 AM # indicates an id. For instance, if you had #blah {color: #000; } in your HTML you'd have <div id="blah"></div> (or span or p, as the case may be ;)) You can only use an id on a page once. Think of id as "individual." Now, . indicates a class. If you had: .blah {color: #000;} You would have <div class="blah"></div> (Or span class or p class, etc,) Classes you can use more than once. Think of classes as a group of people who share the same traits (ie, students in a classroom). Hope that explanation made sense. :P Combat Babe 08-07-2004, 09:15 AM oh, ok. Well then, this whole time I've been using classes once when I should've used ids. Guess I could refrane from that this time round. Just thought I would clear that up before I started css for my new layout. weird girl 08-07-2004, 09:19 AM oh, ok. Well then, this whole time I've been using classes once when I should've used ids. Guess I could refrane from that this time round. Just thought I would clear that up before I started css for my new layout. Both classes and ids have their uses. If you only need to use it once on a page, id would be ideal, ie, for layout positioning attributes and such, but classes are great if say, you wanted to have some text be another color from the default. :) Both are extremely useful. :D |