<div> tag with class and id element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<div> tag with class and id element?

Can someone explain to me a brief description on <div> tag with class and id element?I have noticed it in many websites but have not seen its usage in the HTML5 tutorial except with style.

9th Oct 2016, 9:31 AM
Sanjai Mampala
Sanjai Mampala - avatar
3 Answers
+ 2
The div tag has changed in HTML5, there are now dedicated tags for the more common div usage with class and id attributes. Where you would normally write <div id="header"> for example there is now a new HTML5 element called <header> to represent the same thing.
9th Oct 2016, 9:45 AM
Andrew Dunk
Andrew Dunk - avatar
+ 2
ID's are unique - each element can have only one ID and each page can have only one element with that ID. On the other hand, classes are NOT unique. You can use the same class on multiple elements and you can use multiple classes on the same element. This is very good article, read it. :) https://css-tricks.com/the-difference-between-id-and-class/
9th Oct 2016, 9:46 AM
Jakub ADAMEC
Jakub ADAMEC - avatar
0
@Andrew Dunk yes I do understand that <header> tag in HTML5 has replaced <div id=header> but in some webpages they use div tags in id and class for certain page content to be displayed;thats where I had a doubt.but thanks for the explanation @Jakub Adamec Thanks for the explanation and web page link.
9th Oct 2016, 10:02 AM
Sanjai Mampala
Sanjai Mampala - avatar