Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

class vs id in html

ID: 
In Html for an element ID name starts with the “#” symbol followed by a unique name assigned to it.
Only one ID selector can be attached to an element.
Id is unique in a page and can only apply to at most one element

Class:
On the other hand class assigned to an element has its name starts with “.” followed by class name.
Multiple class selectors can be attached to an element.
The class can be applied to multiple elements so it could be multiple times on a single page.
 
PREVIOUS NEXT
Tagged: #class #id #html
ADD COMMENT
Topic
Name
7+2 =