Relevance of divs in html5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Relevance of divs in html5

Are divs still important/used in html5 or are the new structural elements like nav, article or section used instead just like divs were used before? Or are these just an addition and divs are used in between them etc. For example is it a better choice to use section just like a div and make a section for every box/piece of content and end up with many sections or just use divs inside the sctions? Thanks and sorry for the noob question :)

9th Oct 2018, 5:06 PM
Stefan
Stefan - avatar
1 Answer
+ 2
You should use the new ones if possible, yes! However! Those new tags all have meaning; spamming <section> everywhere wouldn't be right as it's supposed to be used for "thematic grouping" and that's not appropriate a lot of times. <div> is a generic container with no meaning at all and the major reason we will never get rid of it is CSS. It is a neutral hook to target any number of elements in a stylesheet. And if you use it like that that's fine. I guess you can try and remove all the divs and spans of your document in your head and if the markup is structurally sound still then you did it right.
10th Oct 2018, 11:27 AM
Schindlabua
Schindlabua - avatar