0
What the difference between IDs and classes ?
6 Antworten
+ 5
ID :
YOU CAN ONLY HAVE SINGLE ID NAME MEANS YOU CAN USE ID IN ANY OF HTML TAGS YOU WANT BUT ID NAME GIVEN TO ONE TAG CANNOT BE USED IN ANOTHER.
EG :
<p id="paragraph"></p>
THAN YOU CANT USE ID NAME paragraph IN ANY OTHER TAG HAVING ID.
YOU CAN SELECT IT USING #.
CLASS :
YOU CAN HAVE CLASS NAME AS MUCH AS YOU WANT.
EG :
<p class="paragraph"></p>
<p class="paragraph"></p>
YOU CAN HAVE MULTIPLE CLASS HAVING paragraph AS A NAME.
YOU CAN SELECT IT USING (.).
+ 2
what language?
if its html its easy
ids have to be unique(per page).
classes not.
+ 1
MEET MEHTA thats the long way
+ 1
Ids can only be applied once per page,while classes can be used as many times on a page as needed
+ 1
I'll say id can be used once in a page but class multiple times