
180 views
HTML5 Semantics
HTML5 introduced several new semantic elements that provide more meaning and structure to the content of a web page. These elements help improve accessibility, search engine optimization, and overall organization. Here are some of the key semantic elements in HTML5:
<header>
: Represents the introductory content or a container for a group of introductory content, typically containing the site title, logo, navigation, or other header-related elements.<nav>
: Defines a section of navigation links, typically used for site navigation menus.<main>
: Represents the main content of the document, excluding headers, footers, and sidebars. Each HTML document should have only one<main>
element.<section>
: Defines a standalone section of a document, such as chapters, tabbed content, or thematic groups. It helps organize content into meaningful sections.<article>
: Represents a self-contained composition that can be independently distributed or syndicated. It can represent blog posts, news articles, forum posts, or any other similar content.<aside>
: Represents content that is tangentially related to the main content and can be considered separate from it. It often appears as sidebars, pull quotes, or related content sections.<footer>
: Defines the footer of a document or a section, typically containing copyright information, contact details, or other relevant information.<figure>
: Represents self-contained content, such as images, illustrations, diagrams, or code snippets, that is referenced in the main content. It is often accompanied by a<figcaption>
to provide a caption or description.<figcaption>
: Represents a caption or description for a<figure>
element, providing context or additional information.<time>
: Represents a specific date, time, or duration. It can be used to mark up publication dates, event timings, or other time-related information.<mark>
: Highlights or marks a specific section of text, typically for highlighting search terms or indicating important information.<progress>
: Represents the progress of a task or process, such as file uploads, form completion, or loading indicators.<meter>
: Represents a scalar measurement within a known range, such as ratings, progress bars, or performance indicators.<details>
: Represents additional information or disclosure content that can be shown or hidden. It often consists of a summary and content that can be expanded or collapsed.<summary>
: Provides a summary or caption for the details element, acting as a visible heading for the associated details content.
These are just a few examples of the semantic elements introduced in HTML5. By using these elements appropriately, you can give more meaning and structure to your HTML documents, making them more accessible, SEO-friendly, and easier to understand for both humans and machines.