What are the Semantic and Non-semantic elements in HTML?

Share

Overview

Semantic Elements represent their meanings to both the developer and the browser. The tag in the code tells the developer and the browser what to do. It defines the different sections and layout of web pages, which makes HTML more easily understandable.

Semantic elements in HTML

In HTML, there are some semantic elements used to define when developing the frontend of the web pages.

Examples

Below are some examples of semantic tags:

  • The <article> element specifies the independent, self-contained content.
  • The <nav> element defines a set of navigation links.
  • The <aside> element represents sidebars or call-out boxes.
  • The <section> element represents a section of the document.
  • The <details> tag specifies the tag for additional details.
  • The <header> tag represents a container for introductory content or a set of navigational links.
  • The <footer> tag defines a footer for a document or section.
  • The <main> tag specifies the main page.

Non-semantic elements in HTML

Non-semantic elements are similar to semantic elements, but they do not have any meaningful content. They can be used with different attributes to mark up semantics usual to a group.

Examples

  • The <div> tag is used to make the division of content in the web pages.
  • The <span> tag is an inline container used to mark up a part of a document or a part of the text.