Ding! Ding! Round one.

Sections v Divs, the age old battle. I remember some time back while working on a collaboration project with one of my friends, I noticed that he had a bad case of the divitis. All his code was plastered with divs, what a site!(for me). I, on the other hand, stuck to a well balanced mixture of section tags and divs which enraged him from our numerous merge conflicts. So, what really is the difference?

It’s all in the semantics. This means that the use of either is defined by what kind of content you are displaying. It would look absurd to flood your code with divs, which happens in most cases. Use sections where you have a defined part of information and divs as a by-the-way chunk of information. The section tags seems more official, to me.

Always place your content on a webpage semantically, with relevance to the information you want to present in that section of the webpage, not according to the styling behind it. If, like me, you get to work with a person who has a bad case of divitis…help your fellow commrade, clean up his code and teach them a thing or two about semantics.

May the code be ever in your favour!

Written on June 15, 2016