--- url: "https://web.dev/learn/html/headings-and-sections" titulek: "Headings and sections | web.dev" h1: "Headings and sections Stay organized with collections Save and categorize content based on your preferences." popis: "How to correctly use sectioning elements to give meaning to your content." jazyk: "en" kanonicka: "https://web.dev/learn/html/headings-and-sections" drobecky: ["web.dev", "Resources", "HTML"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:57:31" znaku: 13730 slov: 2217 kodovani: "iso-8859-2" sha256: "d77323522fd0b274b4b29106260c8cf195ca120f967485baed3d8d7d93580007" --- Headings and sections Stay organized with collections Save and categorize content based on your preferences. In the last section you learned how, even if you don't know what the words on a page mean, when semantic elements provide the document with meaningful structure, others—the search engine, assistive technologies, a future maintainer, a new team member—will understand the outline of the document. In this section, you'll discover document structure; you'll recap the sectioning elements from the previous section; and mark up the outline for your application. Choosing the right elements for the job as you code means you won't have to refactor or comment out your HTML. If you think about using the right element for the job, you'll most often pick the right element for the job. If you don't, you probably won't. Now that you [understand markup semantics](/learn/html/semantic-html) and are aware of why choosing the right element is important, once you learn about all the different elements, you will generally pick the right element without much, if any, additional effort. First, you should build a site header. Start with non-semantic markup, and work your way to a good solution so that you can learn the benefits of the HTML section and heading elements along the way. If you put little to no thought into the semantics for our header, you might use code like this: ` ` CSS can make (almost) any markup look right. But using the non-semantic `
` for everything actually creates extra work. To target multiple `
`s with CSS, you end up using ids or classes to identify the content. The code also includes a comment for each closing `
` to indicate which opening tag each `
` closed. While the `id` and `class` attributes provide hooks for styling and JavaScript, they add no semantic value for the screen reader and (for the most part) the search engines. You can include `role` attributes to provide semantics to create a good accessibility object model (AOM) for screen readers: `
Machine Learning Workshop
Register About Instructors Testimonials
` This at least provides semantics and enables using attribute selectors in the CSS, but it still adds comments to identify which `
` each `
` closes. If you know HTML, all you have to do is think about the purpose of the content. Then you can write this code semantically without using `role` and without needing to comment the closing tags: `

Machine Learning Workshop

` This code uses two semantic landmarks: `
` and `