Java Scrap Book  

Java Scrap Book > Difference between Id and Class

Difference Between Ids and Classes

IDs - can only be used once within the page and help pinpoint a specific item.It can be targeted using things like CSS or Javascript, and can be used on any item you wish to target. ID's are unique-

  • Each element can have only one ID
  • Each page can have only one element with that ID
  • Class - can be used over and over to target parts of the page. Classes are NOT unique-

  • You can use the same class on multiple elements.
  • You can use multiple classes on the same element.

  • Copyright © 2013-2019 is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

    Contact email: