{"id":322,"date":"2025-06-23T15:49:21","date_gmt":"2025-06-23T10:19:21","guid":{"rendered":"https:\/\/www.itvedant.com\/blog\/?p=322"},"modified":"2025-07-08T11:40:32","modified_gmt":"2025-07-08T06:10:32","slug":"list-of-container-tags-in-html-comprehensive-guide-with-examples","status":"publish","type":"post","link":"https:\/\/www.itvedant.com\/blog\/list-of-container-tags-in-html-comprehensive-guide-with-examples\/","title":{"rendered":"List of Container Tags in HTML (Comprehensive Guide with Examples)"},"content":{"rendered":"\n<p>HTML <strong>container tags<\/strong> are the building blocks that hold and organize content on a webpage. In this comprehensive guide, we\u2019ll provide a <em>list of container tags in HTML<\/em>, explain each in detail with code examples, and compare them to non-container (void) tags.<\/p>\n\n\n\n<p>By the end, you\u2019ll understand how to use these tags in modern semantic HTML5 practices to create well-structured, accessible web pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Understanding HTML Container Tags<\/strong><\/h2>\n\n\n\n<p><strong>What are container tags?<\/strong> In HTML, most elements are written with an opening tag, content inside, and a closing tag. This structure lets them <em>contain<\/em> other content or text. For example, a paragraph is written as &lt;p&gt; &#8230; &lt;\/p&gt;.<\/p>\n\n\n\n<p>Such elements are often called <strong>container tags<\/strong> because they enclose (or contain) content between a start and end tag. In contrast, a few elements don\u2019t need a closing tag and cannot have any content inside \u2013 these are <strong>empty<\/strong> or <strong>void<\/strong> elements.<\/p>\n\n\n\n<p>A standard HTML element (container tag) follows the pattern <strong>opening tag + content + closing tag<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn_web_development\/Core\/Structuring_content\/Basic_HTML_syntax#:~:text=The%20element%20is%20the%20opening,followed%20by%20the%20closing%20tag\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. For instance, a basic paragraph element looks like:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;p&gt;This is a paragraph enclosed by a container tag.&lt;\/p&gt;<\/p>\n\n\n\n<p>Here &lt;p&gt; is the opening tag, &lt;\/p&gt; is the closing tag, and the text in between is the content. Container tags can also contain other nested HTML elements, not just text. You can wrap sections of your page in container tags to group related elements together.<\/p>\n\n\n\n<p><strong>Empty (void) tags vs container tags:<\/strong> Not all HTML tags have closing tags. Some tags are self-contained, meaning they don\u2019t (and can\u2019t) wrap any content. These are the <strong>void elements<\/strong> of HTML. Void elements only have a single tag (no separate closing tag) and <strong>cannot have child elements or text content inside<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Void_element#:~:text=A%20void%20element%20is%20an,be%20specified%20for%20void%20elements\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. For example, the line break tag &lt;br&gt; or an image tag &lt;img&gt; are void elements. You write them like &lt;br&gt; or &lt;img src=&#8221;photo.jpg&#8221; alt=&#8221;&#8230;&#8221;&gt; without any closing tag. They represent something by themselves (a line break, an image, etc.) and do not enclose other content. In other words, void tags <strong>do not follow the opening tag \u2192 content \u2192 closing tag pattern<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn_web_development\/Core\/Structuring_content\/Basic_HTML_syntax#:~:text=match%20at%20L549%20Not%20all,an%20image%20file%20onto%20a\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>Common examples of void (empty) tags include: &lt;br&gt; (line break), &lt;hr&gt; (horizontal rule), &lt;img&gt; (image), &lt;input&gt; (form input), &lt;meta&gt; (metadata), &lt;link&gt; (external resource link), and others. These cannot contain content \u2013 for instance, you can\u2019t put text inside a &lt;img&gt; tag or it would be invalid HTML.<\/p>\n\n\n\n<p>By contrast, <strong>container tags<\/strong> (sometimes simply called <em>non-void<\/em> elements) <strong>must have a closing tag and can contain content or other HTML elements<\/strong>. Almost all familiar HTML tags (like &lt;div&gt;, &lt;p&gt;, &lt;span&gt;, etc.) are container tags. They define a structure or section on the page and wrap whatever content belongs in that section. Using container tags properly helps you organize content logically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why use container tags?<\/strong><\/h3>\n\n\n\n<p>Container tags are essential for giving structure to an HTML document. They allow developers to group related content, apply styles or scripts to that group via classes or IDs, and create a logical hierarchy of information on the page. In HTML5, we gained many <strong>semantic container elements<\/strong> (like &lt;header&gt;, &lt;section&gt;, &lt;article&gt;, etc.) that describe the role of the content they contain, making the structure more meaningful.<\/p>\n\n\n\n<p>These semantic containers improve both human readability and machine readability (for example, search engines and assistive technologies can better understand your page\u2019s layout and content meaning).<\/p>\n\n\n\n<p>Using semantic container tags to structure your HTML is considered a best practice. According to MDN, content sectioning elements &#8220;allow you to organize the document content into logical pieces&#8221; and create a meaningful outline of the page\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=Content%20sectioning%20elements%20allow%20you,to%20identify%20sections%20of%20content\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. For instance, instead of a jumble of &lt;div&gt;s, you might use a &lt;header&gt; for introductory content, &lt;nav&gt; for navigation menus, &lt;main&gt; for the main content, and &lt;footer&gt; for page footer information.<\/p>\n\n\n\n<p>This not only organizes the HTML logically but also <strong>provides extra semantics<\/strong>. Screen readers and other tools get <em>clues<\/em> about the content (e.g., knowing which part is navigation vs. main content) when you use these tags\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn_web_development\/Core\/Accessibility\/HTML#:~:text=Another%20consideration%20when%20creating%20layouts,screen%20reader%20support%20is%20like\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>In short, container tags (especially semantic ones) make your HTML more structured, accessible, and SEO-friendly.<\/p>\n\n\n\n<p>Now, let\u2019s dive into the <strong>list of common container tags in HTML<\/strong>. We\u2019ll explain each tag, and its purpose, provide an example, and note any special usage tips. We\u2019ll focus on HTML5 semantic container elements and other widely-used containers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common HTML Container Tags (List with Examples)<\/strong><\/h2>\n\n\n\n<p>Below is a list of popular HTML container tags and their uses. Each of these tags has an opening and closing form (e.g., &lt;tag&gt; &#8230; &lt;\/tag&gt;) and is used to group or wrap content. We\u2019ll cover:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>&lt;div><\/strong> \u2013 Generic container for content<\/li>\n\n\n\n<li><strong>&lt;section><\/strong> \u2013 Section of a document<\/li>\n\n\n\n<li><strong>&lt;article><\/strong> \u2013 Independent article\/content unit<\/li>\n\n\n\n<li><strong>&lt;nav><\/strong> \u2013 Navigation section<\/li>\n\n\n\n<li><strong>&lt;header><\/strong> \u2013 Header of a page or section<\/li>\n\n\n\n<li><strong>&lt;footer><\/strong> \u2013 Footer of a page or section<\/li>\n\n\n\n<li><strong>&lt;aside><\/strong> \u2013 Tangential or sidebar content<\/li>\n\n\n\n<li><strong>&lt;main><\/strong> \u2013 Main content area<\/li>\n\n\n\n<li><strong>&lt;form><\/strong> \u2013 Form container for user input<\/li>\n\n\n\n<li><strong>&lt;fieldset><\/strong> \u2013 Group of form fields with caption<\/li>\n\n\n\n<li><strong>&lt;details><\/strong> (and &lt;summary>) \u2013 Expandable\/collapsible content section<\/li>\n<\/ul>\n\n\n\n<p>Each tag is explained with when to use it and a simple HTML example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;div&gt;<\/strong><strong> \u2013 The Generic Container<\/strong><\/h3>\n\n\n\n<p>The &lt;div&gt; tag (short for \u201cdivision\u201d) is the most basic container element in HTML. The &lt;div&gt; <strong>is a generic container for flow content<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/div#:~:text=The%20%60,applied%20to%20its%20parent%20element\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. This means it can contain virtually any other HTML elements (paragraphs, headings, images, other divs, etc.) but itself has <strong>no special semantic meaning<\/strong>. By default, a &lt;div&gt; doesn\u2019t affect the page\u2019s presentation or behaviour until you style it with CSS or manipulate it with scripts. It\u2019s essentially an empty box that you can fill with content and then style or position as needed.<\/p>\n\n\n\n<p><strong>Technical details:<\/strong> &lt;div&gt; is a <em>block-level<\/em> element, which means it will start on a new line and stretch to the full width available by default. It is commonly used to group other elements for purposes such as styling (via CSS classes or IDs) or scripting. As a pure container, &lt;div&gt; <strong>does not convey any particular meaning about its content<\/strong> on its own\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/div#:~:text=As%20a%20,and%20so%20on\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. Developers often use it as a last-resort container when no other semantic element is appropriate.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;div&gt;<\/strong><strong>:<\/strong> Suppose you want to apply a CSS style or a script to a section of your page that contains an image and a caption. You could wrap them in a &lt;div&gt;:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;div class=&#8221;photo-card&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;img src=&#8221;puppy.jpg&#8221; alt=&#8221;A cute puppy&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;Meet our new puppy!&lt;\/p&gt;<\/p>\n\n\n\n<p>&lt;\/div&gt;<\/p>\n\n\n\n<p>In this example, the &lt;div&gt; with the class &#8220;photo-card&#8221; contains an image and a paragraph. By targeting .photo-card in CSS, you could style the whole block (for example, add a border, padding, background colour, etc.). The &lt;div&gt; is purely for grouping these elements as one unit.<\/p>\n\n\n\n<p>When to use &lt;div&gt;: Use &lt;div&gt; <strong>when no other semantic container tag is suitable<\/strong>. It\u2019s great for wrapping a section of content for styling or scripting hooks. However, if your content has a specific purpose (like navigation links, an article, a sidebar, etc.), you should prefer a more specific HTML5 semantic element (such as &lt;nav&gt;, &lt;article&gt;, &lt;aside&gt;, etc.) for clarity. Using meaningful elements in place of generic &lt;div&gt; where possible improves the semantics of your HTML.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;section&gt;<\/strong><strong> \u2013 The Section Element<\/strong><\/h3>\n\n\n\n<p>The &lt;section&gt; tag represents a <strong>generic standalone section<\/strong> of a document\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=indexes.%20,heading%2C%20with%20very%20few%20exceptions\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. This is a semantic element introduced in HTML5 to indicate that the content inside is a distinct section of the page (for example, a chapter, a grouping of related topics, or a thematic grouping of content). A &lt;section&gt; typically includes its own heading, and groups related content under that heading.<\/p>\n\n\n\n<p>According to MDN, the &lt;section&gt; element &#8220;represents a generic standalone section of a document, which doesn\u2019t have a more specific semantic element to represent it&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=indexes.%20,heading%2C%20with%20very%20few%20exceptions\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. In practice, you use &lt;section&gt; to wrap content that forms a discrete part of your page\u2019s structure. For instance, a long article might be broken into multiple sections with subheadings, or a homepage might have sections like Latest News, About Us, Services, etc.<\/p>\n\n\n\n<p><strong>Important:<\/strong> It\u2019s recommended that each &lt;section&gt; <strong>has a heading<\/strong> (like an &lt;h2&gt; or &lt;h3&gt; inside it) to identify what that section is about\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=indexes.%20,heading%2C%20with%20very%20few%20exceptions\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. If a section lacks a natural heading, consider if another element (like &lt;div&gt; or &lt;article&gt;) might be more appropriate.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;section&gt;<\/strong><strong>:<\/strong> Imagine you\u2019re structuring a simple webpage with an introduction and a separate section for a list of features:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;section&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h2&gt;Introduction&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;Welcome to our website. Here we do XYZ&#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&lt;\/section&gt;<\/p>\n\n\n\n<p>&lt;section&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h2&gt;Features&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;ul&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Feature 1 \u2013 Fast and reliable&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Feature 2 \u2013 Easy to use&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Feature 3 \u2013 24\/7 Support&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/ul&gt;<\/p>\n\n\n\n<p>&lt;\/section&gt;<\/p>\n\n\n\n<p>In this example, we used two &lt;section&gt; tags. The first contains an introductory paragraph with a heading. The second is a features section with a heading and a list. Each section is a logical grouping of content on the page.<\/p>\n\n\n\n<p>When to use &lt;section&gt;: Use &lt;section&gt; for grouping related content that is part of a larger whole, especially when that group has a heading. If you find yourself creating a generic block of content in the body and you can label it with a heading, &lt;section&gt; is a good choice.<\/p>\n\n\n\n<p>If there\u2019s a more specific semantic tag available (like &lt;article&gt; for a full article or &lt;nav&gt; for navigation), use that instead of &lt;section&gt;. For example, don\u2019t use &lt;section&gt; for your main site navigation menu \u2013 use &lt;nav&gt;. But for general grouped content areas, &lt;section&gt; is ideal.<\/p>\n\n\n\n<p><strong>Section vs. Div:<\/strong> Unlike a plain &lt;div&gt;, an &lt;section&gt; implicitly indicates that its content is grouped thematically. This doesn\u2019t affect rendering by default, but it gives meaning: developers and user agents know the content inside is one section of the page. If you simply need a container for styling with no semantic grouping, stick with &lt;div&gt;. If the content forms a logical section of the document outline, use &lt;section&gt; and include a heading for it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;article&gt;<\/strong><strong> \u2013 The Article Element<\/strong><\/h3>\n\n\n\n<p>The &lt;article&gt; tag represents an <strong>independent piece of content<\/strong> that is self-contained and <strong>intended to be independently distributable or reusable<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=,Asides%20are%20frequently%20presented%20as\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. In other words, an &lt;article&gt; should make sense on its own, even outside the context of the page. HTML5 introduced &lt;article&gt; to semantically mark up things like blog posts, news articles, forum posts, user-submitted comments, or any other standalone item.<\/p>\n\n\n\n<p>According to MDN, &lt;article&gt; represents &#8220;a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable&#8230; Examples include a forum post, a magazine or newspaper article, a blog entry, a product card, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=,Asides%20are%20frequently%20presented%20as\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>This means the content inside an &lt;article&gt; is a unit that could feasibly be syndicated or copied elsewhere (for example, an RSS feed entry or a social media preview).<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;article&gt;<\/strong><strong>:<\/strong> Consider a blog page showing multiple blog posts. Each post can be marked up as an article:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;article&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h2&gt;How to Grow Tomatoes&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;Growing tomatoes at home can be fun and rewarding. &#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;&#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;footer&gt;Written by Jane Doe on &lt;time datetime=&#8221;2025-03-21&#8243;&gt;March 21, 2025&lt;\/time&gt;&lt;\/footer&gt;<\/p>\n\n\n\n<p>&lt;\/article&gt;<\/p>\n\n\n\n<p>&lt;article&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h2&gt;10 Best Tomato Recipes&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;If you have an abundance of home-grown tomatoes, here are 10 recipes &#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;&#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;footer&gt;Written by John Smith on &lt;time datetime=&#8221;2025-03-20&#8243;&gt;March 20, 2025&lt;\/time&gt;&lt;\/footer&gt;<\/p>\n\n\n\n<p>&lt;\/article&gt;<\/p>\n\n\n\n<p>In this snippet, we have two &lt;article&gt; elements, each with its own heading and content, and a footer providing the author and date. Each &lt;article&gt; is a self-contained post. If you took the first &lt;article&gt; out and published it via RSS or copied it to another site, it would still make sense by itself (it doesn\u2019t rely on context from the rest of the page).<\/p>\n\n\n\n<p>When to use &lt;article&gt;: Use it for content that stands on its own. Typical uses are blog posts, news articles, product or team member profiles, user comments (each comment could be an &lt;article&gt;), or even a widget.<\/p>\n\n\n\n<p>Articles can be nested \u2013 for example, a blog post (one article) might contain nested &lt;article&gt; elements for each comment, since each comment is an independent chunk of content related to the main article. If the content is not meant to stand alone (for instance, a section of a single page that isn\u2019t reusable elsewhere), &lt;section&gt; might be more appropriate.<\/p>\n\n\n\n<p><strong>Article vs. Section:<\/strong> A common confusion is deciding between &lt;article&gt; and &lt;section&gt;. The rule of thumb: <strong>If the content could be extracted and used on its own or syndicated, use <\/strong><strong>&lt;article&gt;<\/strong><strong>.<\/strong> If the content is part of a larger narrative or grouping and not meant to stand alone, use &lt;section&gt;.<\/p>\n\n\n\n<p>For example, an &#8220;About Us&#8221; section on a company homepage would be a &lt;section&gt; (because it\u2019s part of that page), whereas a news story on that site would be an &lt;article&gt;. If you have a section of a page that lists multiple independent items (like a list of latest news), each item would likely be an &lt;article&gt; inside a containing &lt;section&gt; or &lt;main&gt;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;nav&gt;<\/strong><strong> \u2013 The Navigation Element<\/strong><\/h3>\n\n\n\n<p>The &lt;nav&gt; tag defines a <strong>section of navigation links<\/strong>. In HTML5, &lt;nav&gt; is the semantic container for major navigation blocks on your site or page. This could be your primary menu, sidebar menu, footer links section, table of contents, or any other grouping of links that form a navigational structure.<\/p>\n\n\n\n<p>Per the HTML5 spec, the &lt;nav&gt; element &#8220;represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=,menus%2C%20tables%20of%20contents%2C%20and\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. Common examples of &lt;nav&gt; usage are menus and tables of contents.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;nav&gt;<\/strong><strong>:<\/strong> Here\u2019s how you might mark up a simple site menu:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;nav&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;ul&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/&#8221;&gt;Home&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/about.html&#8221;&gt;About Us&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/services.html&#8221;&gt;Services&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/contact.html&#8221;&gt;Contact&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/ul&gt;<\/p>\n\n\n\n<p>&lt;\/nav&gt;<\/p>\n\n\n\n<p>In this example, the &lt;nav&gt; contains an unordered list of links. Each &lt;a&gt; (anchor) is a navigation link to a different page. The &lt;nav&gt; element signals that this group of links is for site navigation.<\/p>\n\n\n\n<p>When to use &lt;nav&gt;: Wrap your <strong>primary navigation menus or important sets of links<\/strong> in &lt;nav&gt;. Typical places are the header of a website (for a top menu), a sidebar menu, or even a footer if you have a secondary menu there. You can have multiple &lt;nav&gt; elements on a page (for example, a top navbar and a footer nav). However, not every single group of links needs a &lt;nav&gt; container.<\/p>\n\n\n\n<p><strong>Only use <\/strong><strong>&lt;nav&gt;<\/strong><strong> for major navigational link groups<\/strong>. For instance, a set of social media share icons or a one-off \u201cBack to top\u201d link wouldn\u2019t need a &lt;nav&gt;. Also, links within an article or paragraph (inline links) are just part of the text, not a nav block.<\/p>\n\n\n\n<p>Using &lt;nav&gt; helps accessibility: screen readers can list navigation landmarks, allowing users to jump directly to the nav section. Search engines might also identify the navigation menu more easily. The &lt;nav&gt; element is usually used in conjunction with lists (&lt;ul&gt;\/&lt;li&gt;) of links for structured menus.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;header&gt;<\/strong><strong> \u2013 The Header Element<\/strong><\/h3>\n\n\n\n<p>The &lt;header&gt; tag represents <strong>introductory content<\/strong> for a page or a section\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=documents.%20,h6%3E%20Represent\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>Typically, a &lt;header&gt; contains things like the heading of that page or section, maybe a logo, a tagline, navigational aids, or any overview content. It\u2019s essentially the top part of a section or page that introduces what it\u2019s about.<\/p>\n\n\n\n<p>MDN describes &lt;header&gt; as representing &#8220;introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=documents.%20,h6%3E%20Represent\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. This means you can use &lt;header&gt; not only at the very top of the whole page (for the site header) but also at the start of an article or section to encapsulate that section\u2019s heading and relevant info.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;header&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;header&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h1&gt;My Blog&lt;\/h1&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;Welcome to my personal blog about gardening.&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;nav&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211; navigation links for the blog could go here &#8211;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/index.html&#8221;&gt;Home&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/archive.html&#8221;&gt;Archive&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;\/contact.html&#8221;&gt;Contact&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/ul&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/nav&gt;<\/p>\n\n\n\n<p>&lt;\/header&gt;<\/p>\n\n\n\n<p>In this snippet, the &lt;header&gt; contains the main heading of the site (an &lt;h1&gt;), a short welcome paragraph, and a navigation menu for the site. This might appear at the top of the webpage. If this were the header inside a specific article, it might contain the article\u2019s title, author name, and date.<\/p>\n\n\n\n<p>When to use &lt;header&gt;: Use &lt;header&gt; at the beginning of any significant section or page. Common uses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The top of the entire page (often containing the site name\/logo and main navigation).<\/li>\n\n\n\n<li>The top of an &lt;article> (containing the article\u2019s title, author, publish date, etc.).<\/li>\n\n\n\n<li>The top of a &lt;section> if the section needs an introductory part separate from the rest of the section.<\/li>\n<\/ul>\n\n\n\n<p>It\u2019s fine to have multiple &lt;header&gt; elements on one page, as long as they\u2019re each within different sectioning elements (for example, one for the page, one for an article, etc.). Every &lt;header&gt; is scoped to the nearest ancestor sectioning content (like &lt;body&gt;, &lt;article&gt;, &lt;section&gt;, etc.). One thing to avoid: <strong>don\u2019t put a <\/strong><strong>&lt;header&gt;<\/strong><strong> inside another <\/strong><strong>&lt;header&gt;<\/strong> or inside a &lt;footer&gt; (by definition, headers are at the start, footers at the end). Also, don\u2019t confuse &lt;header&gt; (a container for intro content) with heading tags &lt;h1&gt;-&lt;h6&gt; (which are titles\/labels for sections). Usually, a &lt;header&gt; will include a heading tag, but &lt;header&gt; itself is the wrapper.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;footer&gt;<\/strong><strong> \u2013 The Footer Element<\/strong><\/h3>\n\n\n\n<p>The &lt;footer&gt; tag represents the <strong>concluding or footer content<\/strong> for a page or a section\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=sidebars%20or%20call,or%20links%20to%20related%20documents\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. This usually includes information about the section or page, such as copyright notices, author information, related links, or other metadata. A &lt;footer&gt; typically appears at the bottom of the content it belongs to.<\/p>\n\n\n\n<p>According to MDN, &lt;footer&gt; &#8220;represents a footer for its nearest ancestor sectioning content or sectioning root element. A &lt;footer&gt; typically contains information about the author of the section, copyright data, or links to related documents.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=sidebars%20or%20call,or%20links%20to%20related%20documents\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. For a website\u2019s main footer, this might include site-wide information like copyrights or contact links. For an article\u2019s footer, it might include the author bio, publication date, or related article links.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;footer&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;footer&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;&amp;copy; 2025 My Blog. All rights reserved.&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;Written by Jane Doe. &lt;a href=&#8221;\/contact.html&#8221;&gt;Contact the author&lt;\/a&gt;.&lt;\/p&gt;<\/p>\n\n\n\n<p>&lt;\/footer&gt;<\/p>\n\n\n\n<p>This example shows a simple page footer with a copyright line and an author credit with a contact link. If this footer is at the bottom of an article (inside the &lt;article&gt;), it pertains to that article. If it\u2019s at the very bottom of the page (inside &lt;body&gt; but not inside an article or section), it pertains to the whole page\/site.<\/p>\n\n\n\n<p>When to use &lt;footer&gt;: Use &lt;footer&gt; at the end of a page or section to provide closing content. Common uses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A global site footer at the bottom of the page (often with overall site info, copyrights, perhaps site navigation or social links).<\/li>\n\n\n\n<li>A footer at the end of a blog post or article (with author info, related links, or comments link).<\/li>\n\n\n\n<li>A footer for a &lt;section> if that section has some concluding info separate from the main content.<\/li>\n<\/ul>\n\n\n\n<p>Like &lt;header&gt;, you can have multiple &lt;footer&gt; elements on a page as long as each is for a different section\/article. <strong>Do not nest a footer within a footer<\/strong>. Also, avoid putting content that doesn\u2019t relate to that section inside a footer \u2013 e.g., the site-wide footer shouldn\u2019t contain content that only relates to one article.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;aside&gt;<\/strong><strong> \u2013 The Aside Element<\/strong><\/h3>\n\n\n\n<p>The &lt;aside&gt; tag represents a portion of the page that is <strong>indirectly related to the main content<\/strong> around it\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=newspaper%20article%2C%20a%20blog%20entry%2C,Asides%20are%20frequently%20presented%20as\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. Asides are often presented as sidebars, call-out boxes, or inserts that provide additional information, such as related links, tips, disclaimers, or advertisements. The key is that the content of &lt;aside&gt; is not part of the primary flow of the document; it\u2019s tangential. If you removed the &lt;aside&gt; content, the main content should still make sense without disruption.<\/p>\n\n\n\n<p>MDN says &lt;aside&gt; &#8220;represents a portion of a document whose content is only indirectly related to the document&#8217;s main content. Asides are frequently presented as sidebars or call-out boxes.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=newspaper%20article%2C%20a%20blog%20entry%2C,Asides%20are%20frequently%20presented%20as\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. For example, on a news article page, the article is the main content and a sidebar with related stories or an author bio could be in an &lt;aside&gt;.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;aside&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;aside&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h2&gt;Related Articles&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;ul&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;How to Choose Tomato Seeds&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;5 Gardening Tips for Beginners&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;The Benefits of Home Gardening&lt;\/a&gt;&lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/ul&gt;<\/p>\n\n\n\n<p>&lt;\/aside&gt;<\/p>\n\n\n\n<p>In this snippet, the &lt;aside&gt; contains a list of related articles with its own heading. This aside might be placed to the side of a main article or at the end, indicating these links are supplemental content.<\/p>\n\n\n\n<p>Another example: In a blog post, a &lt;aside&gt; could be used for a brief author biography or a highlight quote pulled from the article.<\/p>\n\n\n\n<p>When to use &lt;aside&gt;: Use it for <strong>supplementary content<\/strong> that supports or is related to the main content, but is not central to it. Common cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Sidebars in articles or pages with related links, additional info, or ads.<\/li>\n\n\n\n<li>An info box or tip that\u2019s placed to the side of an instructional article.<\/li>\n\n\n\n<li>A glossary or list of references related to the primary text.<\/li>\n\n\n\n<li>A pull quote or sidebar quote in an article.<\/li>\n<\/ul>\n\n\n\n<p><strong>Aside vs. Section:<\/strong> If content is somewhat related but not part of the main narrative flow, choose &lt;aside&gt;. If the content is a key part of the document\u2019s flow (even if it\u2019s additional info), it might belong in a &lt;section&gt; or just in the main content. The aside should feel like something that could be skipped on the first read without breaking the understanding of the main content.<\/p>\n\n\n\n<p>Also note: if an &lt;aside&gt; is outside of the main content (like a sidebar that\u2019s present on all pages, containing generic stuff like a list of recent posts or an advertisement), it\u2019s still marked up as &lt;aside&gt;. Essentially, &lt;aside&gt; can be used for any kind of &#8220;sidebar&#8221; content, whether it\u2019s site-wide (like a blog sidebar) or page-specific (like a box within an article).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;main&gt;<\/strong><strong> \u2013 The Main Content Element<\/strong><\/h3>\n\n\n\n<p>The &lt;main&gt; tag represents the <strong>dominant content of the <\/strong><strong>&lt;body&gt;<\/strong><strong> of a document<\/strong>\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=subheadings%2C%20an%20alternative%20title%2C%20or,central%20functionality%20of%20an%20application\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. It is a container for the primary content unique to that page. The idea of &lt;main&gt; is to mark up the central focus of the page \u2014 what the page is about \u2014 excluding recurring elements like headers, footers, navigation, sidebars, or advertisements that repeat across pages.<\/p>\n\n\n\n<p>MDN describes &lt;main&gt; as representing &#8220;the dominant content of the body of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=subheadings%2C%20an%20alternative%20title%2C%20or,central%20functionality%20of%20an%20application\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. There should typically be only <strong>one<\/strong> &lt;main&gt; element per page, and it should encompass the key content. For example, in an article page, the article (and perhaps comments) would go in &lt;main&gt;. On a product page, the product details and description would be in &lt;main&gt;.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;main&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;main&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;h1&gt;Welcome to My Site&lt;\/h1&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;This site is all about gardening tips and tricks. Feel free to explore the articles and tutorials below.&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;!&#8211; main content sections like articles, etc. &#8211;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;section&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;Latest Posts&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211; &#8230; &#8211;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/section&gt;<\/p>\n\n\n\n<p>&lt;\/main&gt;<\/p>\n\n\n\n<p>Here, &lt;main&gt; wraps the primary content of the page \u2013 which includes a welcome message and a section of the latest posts. The header (site title or nav) would be outside this &lt;main&gt;, and perhaps a footer is below it. Everything inside &lt;main&gt; is specific to this page\u2019s purpose.<\/p>\n\n\n\n<p>When to use &lt;main&gt;: Use &lt;main&gt; once on each page to identify the main content area. This helps browsers and assistive technology understand where the main content starts and ends. <strong>Do not nest <\/strong><strong>&lt;main&gt;<\/strong><strong> inside another element<\/strong> (it shouldn\u2019t be inside an article, aside from, the header, footer, or nav).<\/p>\n\n\n\n<p>Typically, &lt;main&gt; is a direct child of &lt;body&gt; in your HTML (after the header nav, before the footer).<\/p>\n\n\n\n<p>For example, a typical webpage structure might be:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;body&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;header&gt;&#8230;site header content&#8230;&lt;\/header&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;nav&gt;&#8230;site navigation&#8230;&lt;\/nav&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;main&gt;&#8230;main page-specific content&#8230;&lt;\/main&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;footer&gt;&#8230;site footer content&#8230;&lt;\/footer&gt;<\/p>\n\n\n\n<p>&lt;\/body&gt;<\/p>\n\n\n\n<p>This way, if someone using a screen reader jumps to the main content, they land on &lt;main&gt; directly, skipping the navigation and header that repeat on every page. Search engines also can prioritize content in &lt;main&gt; as the page\u2019s primary subject matter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;form&gt;<\/strong><strong> \u2013 The Form Element<\/strong><\/h3>\n\n\n\n<p>The &lt;form&gt; tag is a container for interactive controls that allows users to submit information. A &lt;form&gt; in HTML represents a section of a document where you can input data and typically send it to a server for processing\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=%28,based%20forms%20to%20accept\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. In essence, the &lt;form&gt; element <strong>wraps input fields, buttons, and other controls<\/strong> that together form a user input interface (like a contact form, login form, search box, etc.).<\/p>\n\n\n\n<p>Per MDN, the &lt;form&gt; element &#8220;represents a document section containing interactive controls for submitting information.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=%28,based%20forms%20to%20accept\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>All form elements like text fields (&lt;input&gt;), dropdowns (&lt;select&gt;), checkboxes, radio buttons, text areas, submit buttons, etc., must be placed inside a &lt;form&gt; container to be part of that form\u2019s submission.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;form&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;form action=&#8221;\/subscribe&#8221; method=&#8221;POST&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;label&gt;Email: &lt;input type=&#8221;email&#8221; name=&#8221;email&#8221; required&gt;&lt;\/label&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;button type=&#8221;submit&#8221;&gt;Subscribe&lt;\/button&gt;<\/p>\n\n\n\n<p>&lt;\/form&gt;<\/p>\n\n\n\n<p>In this example, the &lt;form&gt; element encloses a label with an email input and a submit button. The action attribute specifies where the form data should be sent (e.g., a URL to handle the subscription), and the method specifies the HTTP method for submission (POST in this case). When the user fills in the input and clicks &#8220;Subscribe&#8221;, the browser will package the form data and send it to the URL defined in action. Without the &lt;form&gt; tag, the input and button won\u2019t work together to submit data.<\/p>\n\n\n\n<p>When to use &lt;form&gt;: Use &lt;form&gt; any time you are collecting input from users to be submitted. Common examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Contact forms (name, email, message fields).<\/li>\n\n\n\n<li>Login or signup forms.<\/li>\n\n\n\n<li>Search forms (a search input and submit button).<\/li>\n\n\n\n<li>Feedback or comment submission forms.<\/li>\n\n\n\n<li>Any interactive fields that need to be processed (even for client-side JavaScript handling, wrapping in &lt;form> can be beneficial for semantics and fallback).<\/li>\n<\/ul>\n\n\n\n<p>Every form should have at least one input or control and usually a submit button (&lt;button type=&#8221;submit&#8221;&gt; or &lt;input type=&#8221;submit&#8221;&gt;). Forms can also include &lt;fieldset&gt; to group related inputs, and each input should ideally have a &lt;label&gt; for accessibility.<\/p>\n\n\n\n<p><strong>Note:<\/strong> If you only want to create an interactive widget that doesn\u2019t submit to a server (for example, a search box that triggers a JavaScript function on the page, or a dynamic filter), you can still use &lt;form&gt; for semantic grouping and accessibility (it won\u2019t submit if you prevent it or have no action).<\/p>\n\n\n\n<p>But if it\u2019s truly not a form, you could also omit &lt;form&gt; and just use a container like &lt;div&gt;. However, using &lt;form&gt; where appropriate helps identify that those controls work together.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;fieldset&gt;<\/strong><strong> \u2013 Fieldset (Group of Form Fields)<\/strong><\/h3>\n\n\n\n<p>The &lt;fieldset&gt; tag is used <strong>inside forms<\/strong> to group related form controls (like inputs) together. It creates a logical (and visual) grouping of form fields, often with a caption. The caption for a fieldset is given by the &lt;legend&gt; tag, which should be the first child of the &lt;fieldset&gt;.<\/p>\n\n\n\n<p>MDN\u2019s definition: The &lt;fieldset&gt; element is &#8220;used to group several controls as well as labels (&lt;label&gt;) within a web form.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=,interactive%20controls%20for%20submitting%20information\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>By grouping related fields (for example, a group of checkboxes that are related, or an address form containing multiple fields like Street, City, and ZIP under one labelled group), you improve the semantics and usability of your form.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;fieldset&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;form&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;fieldset&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;legend&gt;Personal Information&lt;\/legend&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;label&gt;First Name: &lt;input type=&#8221;text&#8221; name=&#8221;first_name&#8221;&gt;&lt;\/label&gt;&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;label&gt;Last Name: &lt;input type=&#8221;text&#8221; name=&#8221;last_name&#8221;&gt;&lt;\/label&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/fieldset&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;fieldset&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;legend&gt;Account Details&lt;\/legend&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;label&gt;Email: &lt;input type=&#8221;email&#8221; name=&#8221;email&#8221;&gt;&lt;\/label&gt;&lt;br&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;label&gt;Password: &lt;input type=&#8221;password&#8221; name=&#8221;password&#8221;&gt;&lt;\/label&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/fieldset&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;button type=&#8221;submit&#8221;&gt;Register&lt;\/button&gt;<\/p>\n\n\n\n<p>&lt;\/form&gt;<\/p>\n\n\n\n<p>In this example, we have a registration form divided into two fieldsets. The first field set (legend &#8220;Personal Information&#8221;) groups the first name and last name fields. The second field set (legend &#8220;Account Details&#8221;) groups the email and password fields. This semantic grouping tells the browser (and user) that certain fields are related. Browsers typically draw a border around a &lt;fieldset&gt; and put the &lt;legend&gt; as a caption on that border by default.<\/p>\n\n\n\n<p>When to use &lt;fieldset&gt;: Use &lt;fieldset&gt; inside a form when you have multiple form controls that form a logical group. Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Grouping address fields (street, city, state, ZIP under &#8220;Address&#8221;).<\/li>\n\n\n\n<li>Grouping a set of checkboxes for multiple options (e.g., a group of subscription preferences).<\/li>\n\n\n\n<li>Grouping radio buttons that belong to the same question (though if they have the same name attribute, they\u2019re already a group, a fieldset with legend can provide a question label).<\/li>\n\n\n\n<li>Any time you want to provide a sub-section inside a form with its descriptive legend.<\/li>\n<\/ul>\n\n\n\n<p><strong>Accessibility tip:<\/strong> The &lt;legend&gt; element serves as the label for the grouped fields, which is important for screen reader users to understand the context of the form controls. Always include a &lt;legend&gt; directly inside &lt;fieldset&gt; (as the first child) to label the group.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>&lt;details&gt;<\/strong><strong> (and <\/strong><strong>&lt;summary&gt;<\/strong><strong>) \u2013 The Details Disclosure Element<\/strong><\/h3>\n\n\n\n<p>The &lt;details&gt; tag creates a <strong>disclosure widget<\/strong> \u2013 a widget that the user can open or close to show or hide additional information\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=Element%20Description%20,using%20the%20%20168%20element\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>This element is a bit different from the others in that it provides built-in interactivity: by default, browsers will render a clickable arrow or triangle next to a summary, and toggling it will show\/hide the content. The &lt;details&gt; element should contain a &lt;summary&gt; element, which is the visible heading for the collapsed content. When the user clicks the summary, the rest of the content inside &lt;details&gt; is revealed.<\/p>\n\n\n\n<p>According to MDN, the &lt;details&gt; element &#8220;creates a disclosure widget in which information is visible only when the widget is toggled into an &#8216;open&#8217; state.&#8221;\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=Element%20Description%20,using%20the%20%20168%20element\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>The &lt;summary&gt; element is used to provide the heading or label for the details box\u200b<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element#:~:text=,element%20open%20and%20closed\">developer.mozilla.org<\/a><\/p>\n\n\n\n<p>. If no &lt;summary&gt; is provided, browsers will typically still render the disclosure triangle but there will be no label, which isn\u2019t useful \u2013 so you should always include a summary.<\/p>\n\n\n\n<p><strong>Example usage of <\/strong><strong>&lt;details&gt;<\/strong><strong> and <\/strong><strong>&lt;summary&gt;<\/strong><strong>:<\/strong><\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;details&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;summary&gt;More information&lt;\/summary&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;This is additional details that you can now see. It was hidden before!&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;p&gt;You can include multiple elements here, like text, images, etc.&lt;\/p&gt;<\/p>\n\n\n\n<p>&lt;\/details&gt;<\/p>\n\n\n\n<p>By default, this will appear as a small triangle or twisty next to the text &#8220;More information&#8221;. Before clicking, the paragraphs are hidden. When the user clicks &#8220;More information&#8221;, the &lt;details&gt; element opens (like an accordion), and the paragraphs inside become visible. Clicking again will hide them.<\/p>\n\n\n\n<p>You can also control the open state via the open attribute (e.g., &lt;details open&gt; to have it expanded by default).<\/p>\n\n\n\n<p>When to use &lt;details&gt;: Use it for sections of content that you want to hide by default and let users expand on demand. Common uses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>FAQs where the question is the summary and the answer is hidden in detail.<\/li>\n\n\n\n<li>A &#8220;Read more&#8230;&#8221; section to expand additional text.<\/li>\n\n\n\n<li>Technical or secondary information that not all readers need, but some might want to see (like advanced notes).<\/li>\n\n\n\n<li>Spoiler content in an article (click to reveal spoilers).<\/li>\n<\/ul>\n\n\n\n<p>The benefit of &lt;details&gt; is that you don\u2019t need custom JavaScript for basic show\/hide functionality; it\u2019s built-in and accessible. The &lt;summary&gt; element will be keyboard-focusable and toggling works with both mouse and keyboard, providing an accessible disclosure widget.<\/p>\n\n\n\n<p><strong>Note:<\/strong> &lt;summary&gt; should be the first child of &lt;details&gt; and there should only be one summary per detail. The rest of the content inside &lt;details&gt; can be any markup that you want to reveal. As a container tag, &lt;details&gt; can hold multiple elements (text, images, etc.) that will be shown or hidden together.<\/p>\n\n\n\n<p>Also, ensure that the content hidden in &lt;details&gt; is not critical for understanding the page if it remains hidden (since some users might not open it). If it\u2019s crucial, maybe it shouldn\u2019t be in a collapsible section.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>These are the most common container tags you\u2019ll encounter in HTML5 for structuring content. There are other container elements as well (for example, &lt;ul&gt; and &lt;ol&gt; list elements are containers for list items, &lt;table&gt; is a container for tabular content, &lt;figure&gt; is a container for media and caption, etc.), but the ones listed above cover the primary structural and semantic groupings for typical web content.<\/p>\n\n\n\n<p>Next, we\u2019ll discuss some <strong>best practices<\/strong> when using container tags and how semantic HTML5 elements can improve your web development.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Best Practices for Using Container Tags (Semantic HTML5)<\/strong><\/h2>\n\n\n\n<p>Using container tags effectively is not just about knowing their definitions, but also about applying them in a way that makes your HTML structure clear and meaningful. Here are some modern usage tips and semantic HTML5 best practices:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Prefer semantic elements over non-semantic ones:<\/strong> Whenever possible, use a meaningful HTML5 element instead of a generic &lt;div>. For example, wrap your navigation links in &lt;nav>, your page header in &lt;header>, main content in &lt;main>, and so on. You <em>could<\/em> use only &lt;div>s to layout a page, but it\u2019s better to use appropriate sectioning elements (nav, footer, article, etc.) as this provides additional meaning to your markup.\u200b<br><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn_web_development\/Core\/Accessibility\/HTML#:~:text=Another%20consideration%20when%20creating%20layouts,screen%20reader%20support%20is%20like\">developer.mozilla.org<br><\/a>. Semantic elements serve as landmarks (e.g., screen readers allow users to jump to the main content or navigation easily when those tags are used).<br><\/li>\n\n\n\n<li><strong>Use headings within sectioning elements:<\/strong> Elements like &lt;section> and &lt;article> are part of the HTML5 outlining algorithm (which conceptually defines a document outline).While the formal outline algorithm isn\u2019t implemented in browsers, the practice remains: give each significant section a heading. This means when you use &lt;section>, include an &lt;h1>\u2013&lt;h6> inside to indicate the topic of that section. Similarly, each &lt;article> usually starts with a title (often an &lt;h1> or &lt;h2> depending on context)\u200b<br><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/article#:~:text=,article%3E%60%20elements\">developer.mozilla.org<br><\/a>. This helps structure the content for both readers and machines.<br><\/li>\n\n\n\n<li><strong>Only one <\/strong><strong>&lt;main><\/strong><strong> per page:<\/strong> As mentioned, you should use a single &lt;main> element to encapsulate the main content. Avoid having more than one, and don\u2019t nest it inside other sectioning tags. &lt;main> should start where your unique page content starts, after the common header\/nav, and end where your common footer begins.<br><\/li>\n\n\n\n<li><strong>Don\u2019t confuse parent-child relationships:<\/strong> Remember that &lt;header>, &lt;footer>, and &lt;aside> relate to the nearest ancestor sectioning element. For example, a &lt;footer> inside an &lt;article> is the footer for <em>that article<\/em>, not the page. A &lt;header> directly inside the body (and not inside another sectioning element) is the page header. Keep this in mind when nesting: if you put a &lt;header> inside a &lt;section>, that\u2019s the header for that section.<br><\/li>\n\n\n\n<li><strong>Nesting container tags logically:<\/strong> You can nest sectioning elements, but do so in a way that makes sense. For instance, you might have a &lt;article> that contains &lt;section>s or a &lt;article> with an &lt;aside> for related info. You could also have a &lt;section> that contains multiple &lt;article>s (e.g., a section listing the latest news with each news item as an article). Ensure the nesting reflects a logical hierarchy of content. Avoid overly deep nesting that doesn\u2019t serve a structural purpose.<br><\/li>\n\n\n\n<li><strong>Use <\/strong><strong>&lt;div><\/strong><strong> as a fallback or for styling hooks:<\/strong> It\u2019s perfectly fine to use &lt;div> containers when needed \u2013 not every grouping has a semantic element. For example, a container used purely for CSS grid layout or flexbox layout may be just a &lt;div> with a class, and that\u2019s okay. Also, if you have to group elements but they don\u2019t constitute a logical \u201csection\u201d of content, &lt;div> is the go-to. Just try not to overuse &lt;div> when a clearer element is available (a phenomenon known as \u201cdivitis\u201d where the markup is littered with unnecessary divs).<br><\/li>\n\n\n\n<li><strong>Accessible naming and roles:<\/strong> Most semantic container tags automatically provide roles for assistive tech. For example, &lt;nav> has the implicit ARIA role of navigation, &lt;main> has role main, &lt;header> and &lt;footer> (when appropriate) can act as banners or contentinfo landmarks. Typically, you don\u2019t need to add ARIA roles to these (and you shouldn\u2019t unless you have a specific reason). Using the correct tag is usually sufficient. If you have multiple of something (like multiple &lt;nav>s), you might want to give them accessible names (e.g., aria-label=&#8221;Primary&#8221; or aria-label=&#8221;Footer Navigation&#8221;) to distinguish them.<br><\/li>\n\n\n\n<li><strong>Visual design vs semantic structure:<\/strong> Keep your HTML structure semantic, and use CSS for visual layout. For example, you might have a sidebar that appears visually on the left. Semantically, that sidebar content could be an &lt;aside> (if it\u2019s secondary) or just a section\/div. Don\u2019t choose containers based on how things look; choose based on meaning, then use CSS to position\/style. This separation ensures your HTML remains meaningful even if the CSS changes or isn\u2019t loaded.<br><\/li>\n\n\n\n<li><strong>Validate and maintain hierarchy:<\/strong> HTML5 is quite flexible, but it\u2019s good practice to ensure your container tags are used correctly. For instance, you shouldn\u2019t put a block-level element like a &lt;section> directly inside a &lt;p> (paragraph), because a paragraph can only contain phrasing content (text, inline elements). Most container tags we discussed (div, section, article, nav, etc.) are block-level. Keep block-level elements at appropriate places in the hierarchy (usually as children of &lt;body> or other sectioning elements, not inside inline contexts). Use a validator or reference if unsure about where an element can be used.<br><\/li>\n<\/ul>\n\n\n\n<p>By following these practices, you leverage HTML5 container tags to create a well-structured document. This not only makes your code easier to understand and maintain but also benefits SEO (search engines appreciate clear structure and meaningful tags) and accessibility (assistive technologies can navigate your content by these landmarks).<\/p>\n\n\n\n<p>As MDN notes, using proper sectioning elements &#8220;provides extra semantics for screen readers (and other tools) to give users extra clues about the content they are navigating&#8221;\u200b, thereby improving the user experience for those users.<\/p>\n\n\n\n<p>Next, let\u2019s address some common questions beginners have about container tags in HTML.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FAQ: HTML Container Tags<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q1: What are container tags in HTML?<\/strong><\/h3>\n\n\n\n<p><strong>A1:<\/strong> <em>Container tags<\/em> in HTML are tags that come in pairs (an opening tag and a closing tag) and are used to <strong>enclose content<\/strong>. They \u201ccontain\u201d other content within them. For example, &lt;div&gt;&#8230;&lt;\/div&gt; or &lt;p&gt;&#8230;&lt;\/p&gt; are container tags because they wrap some content inside. These tags typically affect or define the structure of that content. In contrast, tags like &lt;br&gt; or &lt;img&gt; that don\u2019t wrap any content (no closing tag) are not container tags \u2013 those are called empty or void tags. Essentially, if an element has a distinct opening &lt;tag&gt; and closing &lt;\/tag&gt; and can have stuff between them, it\u2019s a container tag.<\/p>\n\n\n\n<p>Most HTML elements (paragraphs, sections, divs, headers, list items, etc.) are container tags. They help organize HTML documents by nesting content inside them. Container tags are crucial for creating the hierarchy and layout of a webpage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q2: How are container tags different from empty (void) tags?<\/strong><\/h3>\n\n\n\n<p><strong>A2:<\/strong> The difference comes down to whether they can have content inside. <strong>Container tags have content and closing tags; empty tags do not.<\/strong> A container tag (like &lt;section&gt;&lt;\/section&gt; or &lt;span&gt;&lt;\/span&gt;) will wrap some content or other elements between the opening and closing tags. An empty tag (like &lt;br&gt; or &lt;meta&gt;) stands alone \u2013 it\u2019s just a single tag with no closing partner and it cannot enclose any content.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&lt;h1>Title&lt;\/h1> is a container element (the content &#8220;Title&#8221; is inside).<\/li>\n\n\n\n<li>&lt;img src=&#8221;photo.jpg&#8221; alt=&#8221;Photo&#8221;> is an empty element \u2013 it stands alone and you can\u2019t put anything inside &lt;img>.<\/li>\n<\/ul>\n\n\n\n<p>Another way to look at it is: that empty (void) tags <strong>self-close<\/strong> immediately and represent something by themselves (like an image or a line break), whereas container tags define a <em>region<\/em> of the document that holds sub-content. Incorrect HTML, you must close all container tags with a matching &lt;\/&#8230;&gt; (except in a few cases where HTML5 allows optional closing like &lt;li&gt; or &lt;p&gt; closing tags can be omitted by syntax rules, but conceptually they are still containers with content).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q3: When should I use semantic container tags instead of just <\/strong><strong>&lt;div&gt;<\/strong><strong>?<\/strong><\/h3>\n\n\n\n<p><strong>A3:<\/strong> You should use semantic tags (like &lt;header&gt;, &lt;nav&gt;, &lt;main&gt;, &lt;section&gt;, &lt;article&gt;, &lt;aside&gt;, &lt;footer&gt;, etc.) whenever they appropriately describe the content you\u2019re marking up. The rule of thumb: <strong>use the HTML element that best matches the meaning of your content<\/strong>. Use &lt;div&gt; as a fallback if no semantic element fits.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use &lt;header> for the top part of a page or section (logo, title, intro, nav links).<\/li>\n\n\n\n<li>Use &lt;nav> for a block of navigation links.<\/li>\n\n\n\n<li>Use &lt;section> for a generic section of related content (with its own heading).<\/li>\n\n\n\n<li>Use &lt;article> for an independent piece of content (blog post, news article, etc.).<\/li>\n\n\n\n<li>Use &lt;aside> for side content or tangential info.<\/li>\n\n\n\n<li>Use &lt;footer> for bottom-of-page or bottom-of-section content (copyright, author info, etc.).<\/li>\n\n\n\n<li>Use &lt;main> to wrap the main content of the whole page.<\/li>\n<\/ul>\n\n\n\n<p>If none of these apply (for instance, you just need a container to apply styling or scripting, or to group things in a way that isn\u2019t a distinct semantic section), then a &lt;div&gt; is perfectly fine. An example might be a wrapper &lt;div&gt; that groups a set of elements purely for layout (like a flex container) but doesn\u2019t represent a &#8220;section&#8221; of content in itself.<\/p>\n\n\n\n<p>Using semantic containers makes your HTML more meaningful. It helps other developers (and yourself later) understand the structure. It also can improve SEO slightly (search engines can identify which content is nav vs. main vs. footer) and accessibility (screen readers have shortcuts to navigate landmarks like main and navigation). So, prefer semantic tags if you have a clear purpose that matches one of them. Use &lt;div&gt; only when needed for generic grouping.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q4: Can container tags be nested inside each other?<\/strong><\/h3>\n\n\n\n<p><strong>A4:<\/strong> Yes, and HTML structure is all about nesting container tags appropriately. Most container tags can contain other containers, as long as the nesting makes sense and follows HTML rules. For example, you can have an &lt;article&gt; that contains several &lt;section&gt; elements, or a &lt;section&gt; that contains an &lt;article&gt;, or a &lt;nav&gt; inside a &lt;header&gt;, etc. Nesting is how you build complex layouts:<\/p>\n\n\n\n<p>html<\/p>\n\n\n\n<p>CopyEdit<\/p>\n\n\n\n<p>&lt;main&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;article&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;header&gt;&lt;h1&gt;Article Title&lt;\/h1&gt;&lt;\/header&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;section&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;Section in Article&lt;\/h2&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&#8230;&lt;\/p&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/section&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&lt;footer&gt;Author name&lt;\/footer&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;\/article&gt;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&lt;aside&gt;Related info&lt;\/aside&gt;<\/p>\n\n\n\n<p>&lt;\/main&gt;<\/p>\n\n\n\n<p>In this snippet, multiple containers are nested: &lt;main&gt; contains an &lt;article&gt; and an &lt;aside&gt;. The &lt;article&gt; contains its own &lt;header&gt;, a &lt;section&gt;, and a &lt;footer&gt;. This nesting is logical and allowed.<\/p>\n\n\n\n<p>However, <strong>not all nesting combinations are valid<\/strong>. You need to follow content model rules. For example, you shouldn\u2019t put a block-level element inside an inline element (you wouldn\u2019t put a full &lt;div&gt; inside an &lt;a&gt; if that anchor is just wrapping text unless the anchor itself is made block-level, etc.). Similarly, some elements have restrictions (like you shouldn\u2019t put a &lt;header&gt; directly inside another &lt;header&gt;). But in general, sectioning elements and container tags are meant to be nested to create the document outline.<\/p>\n\n\n\n<p>The key is to nest in a way that reflects hierarchy: broad containers (like &lt;main&gt;) at a higher level, with more specific ones inside. Always close tags in the correct order (last opened, first closed) to maintain a well-formed structure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q5: What are some examples of void (empty) tags in HTML (so I can distinguish them from container tags)?<\/strong><\/h3>\n\n\n\n<p><strong>A5:<\/strong> Common <strong>void elements<\/strong> in HTML (which are not container tags) include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&lt;br> \u2013 line break (produces a line break in text)<\/li>\n\n\n\n<li>&lt;hr> \u2013 horizontal rule\/line (thematic break in content)<\/li>\n\n\n\n<li>&lt;img> \u2013 image (embeds an image)<\/li>\n\n\n\n<li>&lt;input> \u2013 input field (various types: text, radio, checkbox, etc.)<\/li>\n\n\n\n<li>&lt;meta> \u2013 metadata (e.g., character set, description, viewport)<\/li>\n\n\n\n<li>&lt;link> \u2013 link to external resource (like CSS stylesheet)<\/li>\n\n\n\n<li>&lt;source> \u2013 source for media elements (like inside &lt;picture> or &lt;audio>)<\/li>\n\n\n\n<li>&lt;track> \u2013 text track for media (subtitles, captions)<\/li>\n\n\n\n<li>&lt;area> \u2013 area in an image map<\/li>\n\n\n\n<li>&lt;embed> \u2013 embedded external content<\/li>\n\n\n\n<li>&lt;param> \u2013 parameter for object (deprecated in modern HTML5 in favor of other tech)<\/li>\n\n\n\n<li>&lt;col> \u2013 column definition in a table colgroup<\/li>\n\n\n\n<li>&lt;wbr> \u2013 word break opportunity (hint for line breaking)<\/li>\n<\/ul>\n\n\n\n<p>These tags are written with just a single tag (no closing tag) because they can\u2019t have content. If you see a slash in them like &lt;br \/&gt; or &lt;img &#8230; \/&gt;, that\u2019s just XML-style self-closing (in HTML5 you can omit the slash, &lt;br&gt; is fine) \u2013 but still, there\u2019s no separate closing tag.<\/p>\n\n\n\n<p>All other HTML tags that are not in this void list are typically container tags (or can act as containers, even if you leave them empty, you theoretically <em>could<\/em> put content in them). For instance, &lt;p&gt; could be empty, but it\u2019s not a void tag because you could put text in it; &lt;p&gt;&lt;\/p&gt; is a container (even if nothing is between, it has an opening and closing tag).<\/p>\n\n\n\n<p>Knowing which tags are void helps you remember to never put content inside them or add a closing tag. If you accidentally write &lt;br&gt;text&lt;\/br&gt;, the browser will likely interpret that as &lt;br&gt; and then just text with a stray &lt;\/br&gt; (which is invalid). So keep void tags self-closed, and use container tags when you need to wrap content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q6: Does using semantic container tags help with SEO and accessibility?<\/strong><\/h3>\n\n\n\n<p><strong>A6:<\/strong> Yes, using semantic container tags <strong>can help with both SEO and accessibility<\/strong>, though it\u2019s not a magic solution \u2013 it\u2019s one of many factors.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SEO:<\/strong> Search engine crawlers analyze your HTML structure. Semantic tags give them hints about what\u2019s what. For example, wrapping your main content in &lt;main> could help the crawler identify the primary content of the page. Using headings within sections (&lt;h1>, &lt;h2>, &#8230;) helps search engines understand the content hierarchy and topics. Navigation menus in &lt;nav> might be recognized as menus (and sometimes search engines use that to generate site links or understand site structure). While modern search algorithms are very advanced and can figure out a lot even from &lt;div>s, using semantic tags aligns with providing clear information. At the very least, it won\u2019t hurt, and it may give slight advantages in how content is parsed or featured (e.g., Google has been known to use the &lt;article> tag as a hint for article content for things like Google News or featured snippets).<br><\/li>\n\n\n\n<li><strong>Accessibility:<\/strong> This is where semantic tags shine. Assistive technologies like screen readers use semantic information to provide a better experience for users who can\u2019t see the page. For example, screen readers have a feature to navigate by landmarks \u2013 they\u2019ll announce that there\u2019s a &#8220;navigation region&#8221; or &#8220;main region&#8221; if you use &lt;nav> or &lt;main>, allowing users to jump to those sections easily. Similarly, headings are extremely important for screen reader users to skim page content. By structuring your page with proper container tags and headings, you enable visually impaired users to understand the layout and jump to content of interest. If everything was a &lt;div> with no semantics, the screen reader would have to read through everything linearly with little clue as to structure.<br><\/li>\n<\/ul>\n\n\n\n<p>Additionally, certain tags come with default behaviours that aid accessibility. For instance, &lt;details&gt; and &lt;summary&gt; provide an accessible way to reveal\/hide content without extra scripting \u2013 the screen reader knows to announce them as expandable sections and the state (expanded or collapsed) is managed automatically. Using a &lt;form&gt; properly groups form controls and allows users to tab through inputs; &lt;fieldset&gt; and &lt;legend&gt; inform them that certain fields are related.<\/p>\n\n\n\n<p>So, by all means, yes \u2013 using semantic container tags correctly is considered the best practice for accessible, SEO-friendly HTML. It makes your site more robust for different user agents, including search bots and assistive devices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q7: What\u2019s the difference between a block-level container and an inline container? Are all container tags block-level?<\/strong><\/h3>\n\n\n\n<p><strong>A7:<\/strong> In HTML\/CSS, elements have a display category by default: <strong>block-level<\/strong> or <strong>inline<\/strong> (there are others like inline-block, flex, grid, etc., but block vs inline is the basic concept). Block-level elements typically start on a new line and take up the full width available, whereas inline elements flow within the text and only take as much width as their content.<\/p>\n\n\n\n<p>Most of the <em>structural container tags<\/em> we discussed (div, section, article, nav, header, footer, aside, main, form, fieldset, details) are <strong>block-level elements<\/strong> by default. That means they will each appear on a new line in normal flow, and you can style them with block layout properties (width, height, margin, etc.). They can contain other block-level or inline elements (depending on the tag\u2019s content model).<\/p>\n\n\n\n<p>However, there are also <strong>inline container elements<\/strong>. For example, &lt;span&gt; is an inline container for phrasing content (text and other inline elements). &lt;a&gt; (anchor) is inline by default and can contain text or inline elements (and even block elements in HTML5, although that\u2019s not typical usage). These are container tags too (because they have closing tags and can contain something), but they behave inline.<\/p>\n\n\n\n<p>So not all container tags are block-level. A &lt;span&gt; is a container for text that doesn\u2019t break the flow into a new line; it\u2019s useful for styling or grouping text within a paragraph. An &lt;em&gt; or &lt;strong&gt; tag (for emphasis or strong importance) are inline containers for text (they have closing tags and contain text, thus they are containers, but semantically for phrasing).<\/p>\n\n\n\n<p>In summary: <strong>Block-level containers<\/strong> (like &lt;div&gt;, &lt;section&gt;, &lt;p&gt;) create larger structural blocks on the page. <strong>Inline containers<\/strong> (like &lt;span&gt;, &lt;a&gt;, &lt;em&gt;) wrap content without disrupting the flow of text. When we talk about &#8220;container tags&#8221; in a general sense, we usually mean any element that can contain content, so that includes both block and inline elements with an opening\/closing tag. But often beginners focus on block-level containers because those are used to create the layout structure, while inline containers are used for styling or semantic purposes within text.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q8: Are there any SEO or content penalties for not using semantic container tags?<\/strong><\/h3>\n\n\n\n<p><strong>A8:<\/strong> There\u2019s no direct &#8220;penalty&#8221; in the sense that your page won\u2019t be down-ranked just because you used a &lt;div&gt; instead of a &lt;section&gt;. However, <strong>not using semantic tags means you\u2019re not taking advantage of potential benefits<\/strong>. Search engines will still index your content if the content is there; they don\u2019t require you to use &lt;article&gt; or &lt;nav&gt; for it to count. But using semantic markup can provide subtle boosts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It may help the search engine identify important parts of your page more easily.<\/li>\n\n\n\n<li>It could improve the chance of getting rich snippets or being included in certain search features (for instance, Google might more easily detect an FAQ section if you mark it up with proper structure, though they prefer explicit structured data, the raw HTML structure can still help).<\/li>\n<\/ul>\n\n\n\n<p>From an SEO perspective, quality content and proper use of headings, titles, meta tags, etc., carry more weight than whether you used &lt;section&gt; vs &lt;div&gt;. However, semantic HTML is part of overall good coding practices, which indirectly contributes to SEO (e.g., better accessibility can lead to more user engagement, which can affect SEO metrics).<\/p>\n\n\n\n<p>So, you won\u2019t get a manual penalty or something for not using semantic tags, but it\u2019s still recommended to use them. There\u2019s essentially no downside to using them correctly, and you future-proof your site for evolving tools (like voice assistants or other devices that might leverage HTML structure).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q9: How can I learn which container tag to use in a given situation?<\/strong><\/h3>\n\n\n\n<p><strong>A9:<\/strong> It comes with understanding and a bit of practice. Here are some tips:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Learn by definition and examples:<\/strong> Familiarize yourself with the definitions (like in this article or via MDN\/W3C documentation) of each semantic element and note the examples of usage. MDN Web Docs and W3Schools both provide examples for tags like &lt;article>, &lt;section>, etc.<\/li>\n\n\n\n<li><strong>Think in terms of content structure:<\/strong> When designing your HTML, outline the content. What is the header of the page? What is the main content vs. side content? Are there distinct sections or is it one continuous narrative? Is some content a complete unit (article) or just a part of the page? By answering these, you can map parts of your outline to HTML elements (header, main, nav, section, article, aside, footer).<\/li>\n\n\n\n<li><strong>Refer to semantic HTML guides:<\/strong> Many tutorials and guides on semantic HTML5 give scenarios. For instance, a tutorial might walk through building a blog page and show where to use article vs section vs aside.<\/li>\n\n\n\n<li><strong>Use browser accessibility tree or outliner tools:<\/strong> Some tools can visualize the structure of your HTML page (the document outline). This might help you see how your usage of container tags defines the outline. (Though note HTML5 outlines algorithm differences, many devs still consider h1-h6 hierarchy).<\/li>\n\n\n\n<li><strong>Keep it logical:<\/strong> If you\u2019re ever unsure, ask yourself: &#8220;If someone else looked at this HTML, would the choice of tag help them understand the purpose of this content?&#8221; For example, if you have a &lt;div id=&#8221;menu&#8221;>, that could just be &lt;nav> which is self-explanatory. Or if you have a &lt;div class=&#8221;article&#8221;> with a bunch of content, likely &lt;article> is more appropriate. The more you explain <em>why<\/em> a &lt;div> is there (through IDs or classes that imply structure), the more hints you should use a semantic tag instead.<\/li>\n<\/ul>\n\n\n\n<p>Finally, don\u2019t stress too much: if you accidentally use a &lt;section&gt; where a &lt;article&gt; might have been slightly better, it\u2019s not a tragedy. Both are sectioning content and will work. The goal is a gradual improvement toward more semantic markup.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>HTML container tags are fundamental for structuring web content. By using the right container for the right job \u2013 and knowing the difference between empty tags \u2013 you create documents that are logically organized and easier to maintain. Embracing semantic HTML5 containers (like &lt;header&gt;, &lt;nav&gt;, &lt;section&gt;, &lt;article&gt;, &lt;aside&gt;, &lt;footer&gt;, &lt;main&gt;) can enhance the clarity of your code, improve accessibility for users, and follow modern best practices for web development. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HTML container tags are the building blocks that hold and organize content on a webpage. In this comprehensive guide, we\u2019ll [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":391,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[63,60,62,44,65,64,61],"class_list":["post-322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-development","tag-block-level-elements","tag-container-tags-in-html","tag-html-container-elements","tag-html-for-beginners","tag-html-structure","tag-html-tag-examples","tag-html-tags-list"],"_links":{"self":[{"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/posts\/322"}],"collection":[{"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/comments?post=322"}],"version-history":[{"count":1,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/posts\/322\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/posts\/322\/revisions\/323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/media\/391"}],"wp:attachment":[{"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/media?parent=322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/categories?post=322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itvedant.com\/blog\/wp-json\/wp\/v2\/tags?post=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}