DEV Community

Jean Japheth Ezekiel
Jean Japheth Ezekiel

Posted on • Updated on

What is the difference between section and div in HTML? Are they not defining sections in both cases?

Top comments (1)

Collapse
 
moopet profile image
Ben Sinclair

div has no semantic meaning at all. You throw divs in pretty much to make containers for CSS or to allow things inside it to do stuff like width: 100%.

There was an old dream called "the semantic web" which developers ignored because it didn't directly affect them and they didn't care about users with disabilities.

section indicates that its contents are different somehow to other sections or "main" kind of containers like footer or aside. This makes the content much easier to parse programmatically - search engines can scrape the page knowing that content is confined to sections and not grab irrelevant noise, screen-readers for visually impaired users can allow them to skip between sections, that sort of thing.