Semantic Elements

HTML <section> element

Groups a thematic portion of a document, usually with a heading. Use div instead when grouping only for styling. A section represents a meaningful topic within a larger document. A heading or accessible name helps identify its subject. Do not replace every layout div with section. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<section>Section content</section>

Return Value

HTMLElement

Content model: Flow content; context-specific ancestor restrictions may apply.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <section>      <h2>Opening hours</h2>      <p>Monday to Friday.</p>    </section>  </body></html>
HTML Reference