Semantic Tags
The use of semantic
tags in an HTML document allows you to clearly convey the meaning of content.
Semantic means “having meaning.” It helps to distinctly define which parts are the header
, main
, footer
, etc.
Using semantic tags helps clearly communicate the meaning of a page to web search engines, aiding in Search Engine Optimization (SEO), and enhances web accessibility.
The main semantic tags are as follows.
<header>
Tag
The <header>
tag is for the header section of a web page, displaying the logo, navigation menu, company name, and more at the top of the webpage.
Example
<header> <h1>My Website</h1> <nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> </header>
<footer>
Tag
The <footer>
tag is for the footer section of a webpage, indicating what goes at the bottom, such as copyright information, link relations, and author info.
Example
<footer> <p>© 2023 My Website. All rights reserved.</p> <nav> <ul> <li><a href="#">Privacy Policy</a></li> <li><a href="#">Terms of Service</a></li> <li><a href="#">Contact Us</a></li> </ul> </nav> </footer>
<nav>
Tag
The <nav>
tag displays the links to navigate to other pages and typically appears within the header.
Example
<nav> <ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav>
<section>
Tag
The <section>
tag is used for grouping specific content under a theme or topic.
For example, contact sections, about sections, or news sections on a webpage can be indicated with a <section>
tag.
Example
<section id="about"> <h2>About Us</h2> <p>Welcome to our webpage!</p> </section>
<article>
Tag
The <article>
tag defines a section that can be independently read or reused. This tag is suitable for blog posts, news stories, user comments, etc.
Example
<article> <h2>Event News</h2> <p>Here is information on upcoming events.</p> </article>
<main>
Tag
The <main>
tag defines the main content of a webpage.
Example
<main> <h1>Welcome!</h1> <p>Thank you for visiting our webpage.</p> </main>
<aside>
Tag
The <aside>
tag is used for additional content that is related to the main content. This typically includes sidebars to the right or left of the main content, providing supplementary information and related links.
Example
<aside> <h2>Announcements</h2> <p>Check out the events!</p> <div> <a href="#">Learn more about the event</a> </div> </aside>
Using semantic tags can clearly convey the meaning of the page to web search engines.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help