Jump to content

id and class confusion


ankur218

Recommended Posts

Hello everyone, I am new to CSS. I was going through many references but none of them made me understand the difference between id and class. I saw many css files but couldn't figure when they are used and when they must be avoided. Could you please explain me in detail? Cheers

Link to comment
Share on other sites

when your element will share same characteristic you will use class. when your element have unique characteristic you will use id. many elements can have same class in one page but there can't be two same id. id is unique/ most of the time you will need to use class.

Edited by birbal
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...