Why # in CSS?
Why # in CSS?
Out of context: Reply #13
- Started
- Last post
- 33 Responses
- oliveira0
Okay, i'll try to clear it up for you.
You use an ID (#) to define a block that appears ONCE in a page. Something unique. You use a class to define objects that repeat several times, like several "pinkText" objects would all be derived from .pinkText
Examples for ID: #header, #footer, #right-bar, #left-bar, #veryspecialwork
Examples for Classes: .textBlock, .pansyGreenBox, .poem, .photo
The things defined by classes are likely to repeat several times through a page. IDs on the other hand, are used to define unique items.
Better?