TOP CATEGORIES

×

What is the difference between class and id in HTML?

S

Sandeep

There are many differences between class and id in HTML, I'm going to list the few most important differences.

  • In HTML, id is unique whereas class is not.
  • An HTML element can't have more than one id but it can have more than one class. 
  • Two or more elements in an HTML page can't have the same id but can have the same class.
  • The priority of id is higher than that of class in HTML web page. 

1 votes

S

Shivangi Tandan

The basic difference between ID and Class in HTML:

ID - Id always a unique, in HTML webpage we can call only one time in a whole page BUT

Class - Class is not unique, we can call the same class many times in the HTML web page.

0 votes

K

Katla Srilaxmi

the main difference is that id must be unique in html,while classes can have duplicates values

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)