CSS Tricks defines the difference between ID and Class

I thought CSS Tricks did a great job explaining the Difference between ID and Class. I highly recommend checking it out.

The basics that struck me in this article were Class is like a barcode. Every item in a store has a bar code. They usually describe the product, where it was placed in the store, what color or style it is along with the price. This is something that several product could have the same barcode if they are all the same product- ipods for example.

They mentioned though that ID is more like a serial number each ipod has it’s own unique serial number for product registration.

The point here is that Class is like a barcode that can be used on multiple areas within the page for multiple elements. The ID on the other hand is more like the serial number in that it is only used once to identify one element.

Please share you thoughts on this article or the topic of Class vs. ID. Thanks!

 

4 thoughts on “CSS Tricks defines the difference between ID and Class”

Leave a Comment

Your email address will not be published. Required fields are marked *