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

Japheth Ezekiel @iamdejean

About: Front-End Developer | Blockchain Developer

Location:
Nigeria
Joined:
Aug 31, 2018

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

Publish Date: Oct 23 '19
9 1

Comments 1 total

  • Ben Sinclair
    Ben SinclairOct 23, 2019

    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.

Add comment