What are some common semantic HTML elements (e.g., , , , , , , )?
Jun 21, 2025 am 12:59 AMUsing semantic HTML elements not only improves code readability, but also enhances structural clarity, accessibility and SEO effects. 1. <header> is used for the header of a page or block, often containing a title, navigation or logo; 2. <nav> wraps the main navigation link, such as the top menu or sidebar; 3. <main> defines the unique main content area of ??the page and cannot be nested in other semantic tags; 4. <section> organizes content blocks with titles, and <article> represents independent content units, such as blogs or product cards; 5. <footer> place footer information, such as copyright notice or related links. Using these tags rationally can help build a clear-cut and easy-to-understand web page.
Semantic HTML elements in web pages are not just for writing good code, but for making the structure clearer and more accessible, and search engines can also make the page content easier. The following elements are the most common semantic tags, each with its specific purpose.
<header></header>
: The header of a page or block
<header></header>
is usually placed at the top of the page to contain titles, navigation bars, logos, or introductory content. It doesn't have to be the head of the entire page, it can also be the beginning of a section.
For example:
<header> <h1>My Blog</h1> <nav> <ul> <li><a href="/">Home</a></li> <li><a href="/about">About me</a></li> </ul> </nav> </header>
Note: A page can have multiple <header>
as long as they belong to different content blocks.
<nav>
: Main navigation area
As the name suggests, <nav>
is specially used to wrap the main navigation link. For example, the menu at the top of the website, the link list in the sidebar, etc.
But not all links need to be packaged in <nav>
. For example, auxiliary navigation such as "Previous article" and "Next article" at the end of the article is generally unnecessary.
Common writing methods are as follows:
<nav> <ul> <li><a href="#home">Home</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav>
<main>
: main content area of ??the page
The <main>
tag is used to identify the main content part of the page. This part of the content should be unique and does not include repeated navigation, footer, etc.
A page can only have one <main>
, and it should not be nested in <article>
, <aside>
, <footer>
, <header>
, or <nav>
.
Example:
<main> <h2>Welcome to read this article</h2> <p>This is the main content of the article...</p> </main>
<section>
and <article>
: Organize content blocks
-
<section>
: Represents an area or chapter in a document, usually with a title. Suitable for logically chunking of content. -
<article>
: Represents an independent content block, such as blog posts, comments, product cards, etc., which can be reused or distributed separately.
For example:
<article> <h3>Article Title</h3> <p>This is the content of the article...</p> </article> <section> <h2>About Us</h2> <p>We are a team dedicated to front-end development. </p> </section>
These two tags are often used together, depending on what type of content you are expressing.
<footer>
: The bottom information of a page or block
Similar to <header>
, <footer>
is used to place footer content, such as copyright information, contact information, related links, etc. Similarly, a page can have multiple <footer>
, corresponding to different blocks.
Simple usage:
<footer> <p>? 2025 My Website. All Rights Reserved.</p> <p><a href="/privacy">Privacy Policy</a></p> </footer>
Basically that's it. The rational use of these semantic tags not only improves code readability, but also contributes to SEO and barrier-free access. Although it doesn't seem complicated, it is easy to ignore details in actual projects, such as misuse of tags or excessive nesting, so you still need to pay more attention.
The above is the detailed content of What are some common semantic HTML elements (e.g., , , , , , , )?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

We will also cover another way to execute a PHP function through the onclick() event using the Jquery library. This method calls a javascript function, which will output the content of the php function in the web page. We will also demonstrate another way to execute a PHP function using the onclick() event, calling the PHP function using pure JavaScript. This article will introduce a way to execute a PHP function, use the GET method to send the data in the URL, and use the isset() function to check the GET data. This method calls a PHP function if the data is set and the function is executed. Using jQuery to execute a PHP function through the onclick() event we can use

How to read excel data in html: 1. Use JavaScript library to read Excel data; 2. Use server-side programming language to read Excel data.

Usage of Transform in CSS The Transform property of CSS is a very powerful tool that can perform operations such as translation, rotation, scaling and tilting of HTML elements. It can dramatically change the appearance of elements and make web pages more creative and dynamic. In this article, we will introduce the various uses of Transform in detail and provide specific code examples. 1. Translate (Translate) Translate refers to moving an element a specified distance along the x-axis and y-axis. Its syntax is as follows: tran

Ridge is a border style in CSS that is used to create a 3D border with an embossed effect, which is manifested as a raised ridge-like line.

Use the <br> tag in Dreamweaver to create line breaks, which can be inserted through the menu, shortcut keys or direct typing. Can be combined with CSS styles to create empty rows of specific heights. In some cases, it is more appropriate to use the <p> tag instead of the <br> tag because it automatically creates blank lines between paragraphs and applies style control.

jQuery is a widely used JavaScript library that provides many convenient methods to manipulate HTML elements. In the process of developing web pages, we often encounter situations where we need to determine whether there are sub-elements within an element. In this article, we will introduce how to use jQuery to achieve this function and provide specific code examples. To determine whether there are child elements within an element, we can use jQuery's children() method. The children() method is used to obtain matches

How to view Bootstrap CSS: Using Browser Developer Tools (F12). Find the "Elements" or "Inspector" tab and find the Bootstrap component. View the CSS styles that the component applies in the Styles panel. Developer tools can be used to filter styles or debug code to gain insight into how it works. Proficient in developer tools and avoid detours.

Developer tools help you understand the rendering results of Bootstrap pages, including powerful features: the Elements panel provides HTML structure, real-time code modifications, and class name query. The Styles panel displays applied style rules, including priority and override relationships. The "Network" panel records network requests, analyzing performance bottlenecks and referenced versions.
