IDs are unique, CLASSES can be repeated |
|
IDs are unique, CLASSES can be repeated | |
This is not a tip, rather a reminder to the few designers who don’t know the difference between classes and ids. When structuring your document using css, use ids to define styles for the elements that are to be unique in the document, uses classes to style elements having multiple instances. For example, If you have a div that contains 3 paragraphs of text, 2 of which have the same style (bold, color=green, 14px font-size) and the other having a normal font-weight and color=blue, you may apply css to that document as follows:
AND DON’T CREATE ANOTHER DIV WITH ID #container in the document. |
|