liveBook · Manning

Section element

As explained in Build a Website with ChatGPT

A section element is an HTML element that represents a standalone section of content within a document.

A section element groups a meaningful part of a web page. Use <section> at the start and </section> at the end when a heading and its related content belong together—something you would want to see in the page outline. section 12.2.1

A section with a heading and paragraphs

A section commonly contains a heading plus one or more paragraphs. For example: <section> <h2>Section heading</h2> <p>First paragraph.</p> <p>Second paragraph.</p> </section> The heading names the topic; the paragraphs provide its content. section 6.4 section 12.2.1

On a home page, use one section for each subtopic. A section can include the subtopic title, a short description, and a link to the related page. Place these sections in the main element, which holds the page’s unique content. section 7.3.2 section 7.4.3

To add another section without writing it from scratch:

  • Copy everything from an existing opening <section> tag through its matching closing </section> tag. section 6.4
  • Paste the copy where the new content should appear, such as inside <main>. section 7.4.3
  • Change the heading, text, and link while leaving the surrounding tags intact. section 7.4.3

For a longer article, begin with introductory paragraphs under the article title, then add sections with h3 headings and one or more paragraphs. You can also type a fresh <section> and </section> pair, put the cursor between the tags, and fill it in. section 12.2.4 section 12.3

<section>
    <h2>Section heading</h2>
    <p>
        First paragraph
    </p>
    <p>
        Second paragraph
    </p>
    <p>
        Third paragraph
    </p>
</section>

This compact example shows the basic pattern: one section wraps its heading and three separate paragraphs. section 6.4

How Build a Website with ChatGPT covers it

How deep it goes
Defines sections through headings and paragraphs, then gives copy-paste and manual-creation steps without deeper HTML semantics.
Examples
Uses home-page subtopics and a travel-guide article with h2 or h3 headings and paragraphs.
What it assumes
Teaches section editing for readers who may not know web page code, using a text editor and basic tags.
What you can do after
Operate/configure it by adding, copying, and editing headed content sections in an HTML page.
How it connects
Connects sections with heading elements, paragraphs, main, article, header, nav, footer, and aside.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.