![]() |
The Difference Between ID and Class
The Difference Between ID and Class
|
ID, short for fragment identifier, is a beautiful attribute, but it's very easy to use them improperly.
Classes, like ID's, can also be used to in JavaScript scripts, but unlike ID's, they can be used multiple times in the same HTML document. This separation of content from presentation is what makes sites powered by CSS more robust, but some don't know the full extent to which they can use classes. Classes can not only be used more than once, but more than one can be used on an element: |
ID's are unique, Classes are NOT unique
Each element can have only one ID, the same class on multiple elements. Each page can have only one element with that ID, multiple classes can be used on the same element. |
All times are GMT -7. The time now is 09:54 AM. |
Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.