Common HTML Tags Explained
🎯 Introduction
This article introduces the HTML tags you will use most often to create page content. Think of a typical web page: headings, paragraphs, images, and links. These visible elements are all written using HTML content tags.
Whether you are building a blog, creating a product page, or learning frontend development by making prototypes, these tags are essential. We will explain each one with examples, code, and exercises to help you get started.
🧱 What Are Content Tags?
Content tags define the visible content on a page, including text, images, links, and paragraphs.
Where structural tags such as <div> and <section> organize a page, these tags provide its content.
| Category | Tags | Purpose |
|---|---|---|
| Headings | <h1> ~ <h6> | Define heading levels and default sizes |
| Paragraphs | <p> | Define a paragraph of text |
| Bold text | <strong> | Mark important words |
| Line breaks | <br> | Insert a line break |
| Images | <img> | Embed an image |
| Hyperlinks | <a> | Link to another page or address |
🏷️ Heading Tags
Heading tags define titles and headings, such as an article title, a main heading, or a section heading.
HTML provides six heading levels:
<h1>Level-one heading</h1>
<h2>Level-two heading</h2>
<h3>Level-three heading</h3>
<h4>Level-four heading</h4>
<h5>Level-five heading</h5>
<h6>Level-six heading</h6>
By default, browsers display <h1> as the largest, boldest heading, with subsequent levels getting smaller. These tags also convey meaning, which matters for search engine optimization (SEO).
<h1> per page for its main heading. Use <h2>~<h6> for subheadings according to the content hierarchy.📑 Paragraph Tags
Use the <p> tag to write a paragraph:
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
Each <p> starts on a new line and has some space above and below it by default.
<div> or <h1> inside <p>. This causes unexpected parsing behavior.🖋️ Text Formatting: Bold Text and Line Breaks
Bold Text
Use <strong> or <b> to make text stand out:
<p>Today I learned about <strong>HTML content tags</strong>.</p>
The distinction is:
| Tag | Meaning |
|---|---|
<strong> | Indicates strong importance |
<b> | Draws attention without conveying extra importance |
Prefer <strong> when the text has semantic importance.
Line Breaks with <br>
Use <br> to start a new line without starting a new paragraph:
<p>
First line<br />
Second line
</p>
This is useful for poetry, addresses, or line breaks in form information.
🖼️ Adding Images
Images are an important part of web content. Use the <img> tag to embed them.
<img src="https://example.com/logo.png" alt="Website logo" />
| Attribute | Description |
|---|---|
| src | The image path, either remote or local |
| alt | Alternative text, displayed when the image cannot load |
<img> is a void element and has no closing tag. The alt attribute also supports accessibility and SEO.🔗 Hyperlinks
The <a> tag creates hyperlinks that can open pages, files, telephone links, and more.
<a href="https://www.baidu.com">Visit Baidu</a>
| Attribute | Description |
|---|---|
| href | The destination address |
| target | Where to open the link; _blank opens a new tab or window |
Example:
<a href="https://www.baidu.com" target="_blank">Open Baidu in a new window</a>
Other uses include:
- Downloading a file:
<a href="文件.pdf" download>Download file</a> - Making a call:
<a href="tel:1234567890">Call this number</a> - Sending email:
<a href="mailto:test@example.com">Send email</a>
❓ Questions and Answers
Q1: Can I skip heading levels, for example by starting with <h3>?
This is not recommended. Start with <h1> and follow the heading hierarchy to keep the structure clear.
Q2: How do <b> and <strong> differ?
<b> draws attention to text without indicating extra importance; <strong> conveys importance that search engines can also interpret.
Q3: Does every image need an alt attribute?
Providing it is strongly recommended for accessibility and SEO.
🧪 Exercises
Exercise 1: Create a Simple Introduction Page
<h1>Welcome to My Website</h1>
<p>I am a beginner learning HTML.</p>
<p>My interests include:</p>
<p>
Programming<br />
Design<br />
Photography
</p>
<img src="https://via.placeholder.com/200" alt="My photo" />
<a href="https://www.example.com" target="_blank">Visit my portfolio</a>
Copy this code into your editor and preview the page!
Exercise 2: Create a Product Introduction
<h2>A Great-Value Smartphone</h2>
<p><strong>Phone 100</strong> is an affordable smartphone for everyday use.</p>
<img src="phone.img" alt="Phone 100" />
<p>For more information, visit the <a href="https://www.mi.com" target="_blank">official website</a>.</p>
Copy this code into your editor and preview the page!
🎉 You now know the basic tags for headings, paragraphs, bold text, line breaks, images, and hyperlinks! Keep practicing to build clear, well-structured pages with rich content!
