Understanding HTML5
HTML5 introduces many new elements that improve web development.
The HTML <section> element is used for general sections within a document. It is used for content that does not have a more precise semantic element to define it. A section should almost always have a heading, with only a few exceptions.
The <section> tag is generally used to group together related parts of a webpage. It helps tell browsers and tools like screen readers that the content inside the section belongs together. This makes your website easier to understand for both people and search engines.
Example:
<section>
<h2>Introduction</h2>
<p>Welcome to my blog! Here, I share my thoughts on various topics.</p>
</section>
<section>
<h2>Latest Posts</h2>
<article>
<h3>Understanding HTML5</h3>
<p>HTML5 introduces many new elements that improve web development.</p>
</article>
<article>
<h3>CSS Tips and Tricks</h3>
<p>Enhance your styling with these powerful CSS techniques.</p>
</article>
</section>
Welcome to my blog! Here, I share my thoughts on various topics.
HTML5 introduces many new elements that improve web development.
Enhance your styling with these powerful CSS techniques.
The HTML <section> element must have both start tag and end tag.
The <section> element only has global attributes.
Feature | <section> | <div> |
---|---|---|
Purpose | Groups related content into a thematic section | Groups content with no specific meaning |
Semantic Meaning | Yes – conveys meaning (like a chapter or topic) | No – purely structural |
SEO & Accessibility | Helps search engines and screen readers understand the page | No extra meaning for SEO or accessibility |
When to Use | For meaningful, related content with a heading (e.g., a "Services" section) | For generic containers or layout (like a wrapper div) |