DIVs and Sections

Aren’t Divs and Sections functionally the same thing? Is there any difference? Just curious.

Functionally? yes. Semantically? no.

A div is a “generic block level element” whereas a section is a part of something else.

I’m afraid I can’t offer much more than that. Semantics seems to be something that is largely open to individual interpretation.

The HTML 5.1 Specs do a good job of explaining the <section> element’s usage in it’s Note.

The section element is not a generic container element. When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead.
A general rule is that the section element is appropriate only if the element’s contents would be listed explicitly in the document’s outline.

That’s right in line with the examples given at MDN’s <section> page.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.