View Single Post
11-23-2007, 04:32 PM
#4
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

Mainly, you would use classes to simply, classify elements, say if you have a bunch of links, and you want to give some of them a certian look, you would give them a class.

For IDs, they have to be on unique elements, usually block elements or to identify form fields. A good example would be applying an ID to an anchor tag so you can skip to that part of the page, or to identify main areas of a page, such as your content section, footer, etc.

Divs are mainly used on web pages to divide the page up into logical sections. For example, you would have one div tag for the header of a page, one for the footer, etc.

Spans are plain elements, which apply no formatting to the content you put inside them. They're popular because of this and allow you to specify certain styles in your CSS document knowing that if the user doesn't have CSS enabled, then these styles won't get rendered unlike using a strong or bold tag which would then render your content as bold even if you canceled that property out in your CSS document if the user has disabled or used his own CSS document.