Photo by Chris Scott on Unsplash

Member-only story

What is the difference between <section> and <div>?

Marika Lam

--

<section>

  • Relates to a single theme
  • The content inside is grouped
  • Should appear as an entry in an outline of the page
  • Font size: If a section contains another section, a h1-header in the inner section is displayed in a smaller font than a h1-header in outer section. When using div instead of section the inner div h1-header is diplayed as h1.

<div>

  • Does not convey any meaning aside from any found in its class, langand title attributes
  • Font size: If a <div> contains another <div> the inner div h1-header is the same size as the outer div h1-header.

--

--

No responses yet