To build a webpage, you use HTML tags as building blocks. Most tags have an opening tag <tag>, some content, and a closing tag </tag>, though some “self-closing” tags stand alone.
Here are the most essential HTML tags categorized by their function.
1. Text Content Tags
These tags are used to define the hierarchy and flow of your text.
-
Headings (
<h1>to<h6>): Used for titles and subtitles.<h1>is the most important (main title), and<h6>is the least. -
Paragraph (
<p>): Used for blocks of plain text. -
Line Break (
<br>): A self-closing tag used to start a new line within a paragraph. -
Horizontal Rule (
<hr>): Creates a horizontal line to visually separate sections.
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Lorem Ipsum is a dummy text.
2. Formatting Tags
Used to change the visual or semantic meaning of specific words.
-
<strong>or<b>: Makes text bold. Use<strong>for importance and<b>for visual style. -
<em>or<i>: Makes text italic. Use<em>for emphasized stress and<i>for technical terms or thoughts. -
<u>: Makes text underlined. -
<mark>: Highlights text (usually with a yellow background). -
<small>: Makes the text size smaller, often used for side comments or legal text.
Bold Text
Bold Text
Italic Text
Italic Text
Underlined Text
Mark Text
Small Text
3. Lists
Lists help organize data into digestible points.
-
Unordered List
<ul>: Creates a bulleted list. -
Ordered List
<ol>: Creates a numbered list (1, 2, 3...) -
List Item
<li>: The actual item inside the list.
- List Item 1
- List Item 2
- List Item 3
- List Item 4
- List Item 1
- List Item 2
- List Item 3
- List Item 4
4. Links and Media
This is how you make your website interactive and visual.
-
Anchor
<a>: Creates a hyperlink. -
Image
<img>: Embeds an image. This is a self-closing tag. -
Button
<button>: Creates a clickable button.
5. Container Tags
These are used to group other elements together for styling or layout purposes.
-
<div>: A block-level container. It always starts on a new line and takes up the full width available. -
<span>: An inline container. It is used to wrap small chunks of text or elements inside a line without breaking the flow.
Quick Summary Table
| Tag | Name | Type | Description |
|---|---|---|---|
<a> | Anchor | Inline | Creates a hyperlink to another page. |
<img> | Image | Empty | Displays an image (requires src attribute). |
<ul> | Unordered List | Block | Starts a list with bullet points. |
<div> | Division | Block | A generic container for layout. |
<h1> | Heading 1 | Block | The main heading of a page. |
