0

Should we stop using div tag?

In html5 we are introduced with semantic elements. As div is not a semantic element, should we stop using div tag? And use the semantic elements to divide the sections?

4th Aug 2017, 6:44 AM
Rahul Roy Chowdhury
Rahul Roy Chowdhury - avatar
2 Respuestas
+ 13
The div element has no special meaning at all. It represents its children. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements. ~ W3C Specification The new semantic elements (<article>, <section>) justifiably capture a lot of <div>‘s territory, but <div> still has a place in the HTML5 world. You should use <div> when there is no other more semantically appropriate element that suits your purpose. Its most common use will likely be for stylistic purposes i.e., wrapping some semantically marked-up content in a CSS-styled container ;D
4th Aug 2017, 7:10 AM
Dev
Dev - avatar
+ 6
Better to use semantical elements when good suited to your content, but there's a limited number of such element, and you'll probably encounter case where there's no good suited semantical element for your purpose, so you can use the generic <div> ^^
4th Aug 2017, 7:04 AM
visph
visph - avatar