Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Section vs Div tag

Tags:

html

css

As we are planning to write our own Front-end Framework using HTML5 And CSS3, but The debate with my team is whether to use the section tag as outline wrap or not, because W3.org has not approved the section tag yet.

But, as I went through some debates, I didn't get proper conclusion yet on the usability of section tag, hope I will properly conclude on the topic here!

Thanks, and regards

like image 428
Vinay Avatar asked Sep 29 '22 20:09

Vinay


1 Answers

I think you can apply the logic of 'common usage make right' which was raised in a slightly different but relatable question on the use of the i tag for icons. Though it is in a slightly different context, the principle is the same. Meaning the section tag, whilst may not be technically approved by W3C, it is very widely used. Many WordPress themes and templates use it, and WordPress takes up quite a large percentage of the internet these days.

Before I get stick for saying that, I am not saying use bad practice or use tags when ever for what ever just because every one else does. I mean, if its used semantically, in the right context for the right uses as per the W3C specification then thats ok.

A div tag sometimes doesn't make sense, when you are clearly sectioning an area that has a title and a body of text then use section. If you're creating a box in order to put other elements in to section off a part of your page for a menu or comments or something then thats not really the right kind of section and so use a div or other tags more appropriate.

After all, the SO blog uses them: SO use of section tag

So does the w3c website W3C example of section use

like image 86
DavidT Avatar answered Oct 03 '22 00:10

DavidT