top of page

Learn through our Blogs, Get Expert Help, Mentorship & Freelance Support!

Welcome to Colabcodes, where innovation drives technology forward. Explore the latest trends, practical programming tutorials, and in-depth insights across software development, AI, ML, NLP and more. Connect with our experienced freelancers and mentors for personalised guidance and support tailored to your needs.

Coding expert help blog - colabcodes

A Beginner's Guide to the Most Common HTML Tags

  • Writer: Samul Black
    Samul Black
  • Dec 8, 2024
  • 7 min read

Updated: Aug 12

HTML (HyperText Markup Language) is the foundation of web development. It provides the structure for web pages using a collection of elements, commonly called "tags." Each tag serves a specific purpose, from defining headings and paragraphs to embedding images and links. In this blog, we’ll explore some of the most common HTML tags with practical examples.


HTML tags - colabcodes

What are HTML tags?

HTML tags are the fundamental elements used to structure and define the content of a web page. They are written within angle brackets, such as <tagname>, and typically come in pairs: an opening tag (e.g., <p>) and a closing tag (e.g., </p>). Tags tell the web browser how to interpret and display the enclosed content, such as text, images, links, or interactive elements. For instance, <h1> defines a main heading, <a> creates a hyperlink, and <img> embeds an image. While most tags enclose content, some, like <br> for line breaks or <img> for images, are self-closing. Understanding HTML tags is essential for building the structure and layout of any website.


Basic Structure of an HTML Document

The basic structure of an HTML document provides the foundation for creating any web page. It begins with the <!DOCTYPE html> declaration, which specifies the version of HTML being used. The document is enclosed within <html> tags, representing the root element. Inside, there are two main sections: the <head> and the <body>. The <head> contains metadata about the document, such as its title, character encoding, and links to external resources like stylesheets or scripts. The <body> holds the visible content displayed on the web page, including text, images, links, and other elements. This structured layout ensures browsers can interpret and render the web page correctly.

Before diving into specific tags, every HTML document follows this basic structure:

<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
  </head>
  <body>
    <h1>Welcome to My Web Page</h1>
    <p>This is a sample web page.</p>
  </body>
</html>

Key Tags in the Structure

  • <!DOCTYPE html>: Declares the document type.

  • <html>: The root element of an HTML document.

  • <head>: Contains metadata like the title, character set, and linked stylesheets.

  • <body>: Contains the visible content of the webpage.


Heading Tags (<h1> to <h6>)

Headings are used to structure content hierarchically. There are six levels, with <h1> being the largest and most important, and <h6> the smallest.

<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Sub-subheading</h3>

Paragraph Tag (<p>)

Defines a block of text or a paragraph.

<p>This is a paragraph of text.</p>

Anchor Tag (<a>)

Creates hyperlinks that navigate to other pages or external resources.

<a href="https://www.example.com">Visit Example</a>

Image Tag (<img>)

Displays images. It is a self-closing tag, meaning it doesn’t require a closing tag.


  • src: Specifies the image URL.

  • alt: Provides alternative text if the image doesn’t load.

<img src="example.jpg" alt="Sample Image" width="300" height="200">

Unordered List (<ul>)

Displays bullet-pointed lists.

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

Ordered List (<ol>)

Displays numbered lists.

<ol>
  <li>Step 1</li>
  <li>Step 2</li>
  <li>Step 3</li>
</ol>

Table Tags (<table>, <tr>, <th>, <td>)

Used for displaying tabular data.

<table border="1">
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>John</td>
    <td>25</td>
  </tr>
  <tr>
    <td>Jane</td>
    <td>30</td>
  </tr>
</table>

Div (<div>)

A block-level container used to group content.

<div>
  <h2>Section Title</h2>
  <p>This is some grouped content.</p>
</div>

Span (<span>)

An inline container used for styling or grouping small content pieces.

<p>This is <span style="color:blue;">blue text</span>.</p>

Form Structure

Used to collect user input.

<form action="/submit" method="post">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name">
  <button type="submit">Submit</button>
</form>

Semantic tags provide meaning to the content.

  • <header>: Defines the header of a document or section.

  • <nav>: Represents navigation links.

  • <section>: Represents a section of the document.

  • <footer>: Defines the footer of a document.


<header>
  <h1>Website Header</h1>
</header>
<nav>
  <a href="#home">Home</a>
  <a href="#about">About</a>
</nav>
<section>
  <h2>About Us</h2>
  <p>This section contains information about us.</p>
</section>
<footer>
  <p>&copy; 2024 My Website</p>
</footer>

Summary for Most Common HTML Tags

Understanding the most frequently used HTML tags is crucial for anyone starting in web development. These tags form the backbone of web pages, defining structure, content, and basic formatting. By familiarizing yourself with them, you’ll be able to create well-structured, readable, and accessible websites that serve as a solid foundation for styling and interactivity later on.

Tag

Description

Example Usage

<html>

Defines the root element of an HTML document.

<html> ... </html>

<head>

Contains meta-information like title, links to CSS, and scripts.

<head><title>My Page</title></head>

<body>

Holds all the content visible on the webpage.

<body>Welcome!</body>

<h1>–<h6>

Headings, with <h1> being the largest and <h6> the smallest.

<h1>Main Title</h1>

<p>

Represents a paragraph of text.

<p>This is a paragraph.</p>

<a>

Creates a hyperlink to another page or resource.

<img>

Embeds an image into the webpage.

<img src="image.jpg" alt="Description">

<ul>

Defines an unordered (bulleted) list.

<ul><li>Item</li></ul>

<ol>

Defines an ordered (numbered) list.

<ol><li>Item</li></ol>

<li>

Represents an item in a list (inside <ul> or <ol>).

<li>List Item</li>

<div>

A generic container for grouping elements for styling or scripting.

<div class="container">Content</div>

<span>

A generic inline container for text or elements.

<span style="color:red;">Text</span>

<form>

Creates a form for user input.

<form><input type="text"></form>

<input>

Accepts user input in various formats.

<input type="email" placeholder="Enter email">

<button>

Creates a clickable button.

<button>Click Me</button>

Additional, Less Common HTML Tags

While core HTML tags like <p>, <h1>, and <div> are used on almost every webpage, there’s a whole range of lesser-known tags that can add semantic meaning, improve accessibility, or handle specific use cases. These tags may not appear in every project, but knowing them can help you create richer, more descriptive, and well-structured HTML documents.

Tag

Description

Example Usage

<figure>

Groups media elements (like images) with captions.

<figure><img src="pic.jpg"><figcaption>Caption</figcaption></figure>

<figcaption>

Defines a caption for a <figure> element.

<figcaption>Beautiful Landscape</figcaption>

<mark>

Highlights text for reference or emphasis.

<p>Don’t forget to <mark>submit</mark> your work.</p>

<time>

Represents a date or time in a machine-readable format.

<time datetime="2025-08-12">August 12, 2025</time>

<abbr>

Marks an abbreviation or acronym, with an optional full form.

<abbr title="HyperText Markup Language">HTML</abbr>

<cite>

Indicates a title of a work (book, article, etc.).

<cite>The Great Gatsby</cite>

<kbd>

Represents keyboard input.

Press <kbd>Ctrl</kbd> + <kbd>C</kbd>

<code>

Displays inline code snippets.

Use <code>console.log()</code> to debug.

<samp>

Shows sample output from a program.

<samp>Login successful</samp>

<details>

Creates a collapsible section for additional information.

<details><summary>More Info</summary>Extra content here.</details>

<summary>

The visible summary for a <details> block.

<summary>Click to expand</summary>

<progress>

Displays the progress of a task.

<progress value="70" max="100">70%</progress>

<meter>

Shows a scalar measurement within a known range.

<meter value="0.8">80%</meter>

<address>

Provides contact information for the author or owner of a document.

<address>Email: info@colabcodes.com</address>

Advanced Must-Know HTML Tags

For developers aiming to go beyond the basics, mastering certain advanced HTML tags can greatly enhance accessibility, SEO, and user interaction. These tags often serve specialized purposes, such as defining document structure, embedding external resources, or improving semantics for assistive technologies. Even though they might not appear in beginner tutorials, they’re essential for creating professional-grade, standards-compliant websites.

Tag

Description

Example Usage

<main>

Defines the main content of the document, unique to the page’s purpose.

<main><h1>Blog Post</h1><p>Content here...</p></main>

<article>

Represents a self-contained piece of content, like a blog post or comment.

<article><h2>Post Title</h2><p>Text...</p></article>

<section>

Groups related content with a thematic purpose.

<section><h2>Features</h2><ul>...</ul></section>

<nav>

Identifies a section containing navigation links.

<nav><a href="/">Home</a></nav>

<aside>

Holds content indirectly related to the main content, like sidebars.

<aside>Related Articles</aside>

<header>

Represents introductory content, typically a heading or navigation.

<header><h1>Site Title</h1></header>

<footer>

Contains footer content like credits or links.

<footer>&copy; 2025 Colabcodes</footer>

<picture>

Provides multiple image sources for responsive or art direction purposes.

<picture><source srcset="img.webp" type="image/webp"><img src="img.jpg"></picture>

<source>

Specifies multiple media resources for <audio>, <video>, or <picture>.

<source src="video.mp4" type="video/mp4">

<track>

Adds text tracks (like captions or subtitles) to <video> or <audio>.

<track src="subs.vtt" kind="subtitles" srclang="en" label="English">

<template>

Holds client-side content that is not rendered until activated via JS.

<template><p>Hidden content</p></template>

<slot>

Placeholder in Web Components where child nodes can be inserted.

<slot name="content"></slot>

<canvas>

Used for rendering dynamic graphics via JavaScript.

<canvas id="gameCanvas"></canvas>

<svg>

Embeds scalable vector graphics directly in HTML.

<svg width="100" height="100"><circle cx="50" cy="50" r="40"/></svg>

HTML forms the backbone of the web, providing the structure and semantics that allow browsers to render content meaningfully. From basic tags like <p> and <a> to advanced elements like <template> and <canvas>, each tag plays a specific role in organizing and presenting information. Understanding both the commonly used and specialized tags enables developers to create accessible, responsive, and SEO-friendly websites.


Conclusion

HTML is the backbone of web development, providing the structure and foundation for all web pages. Understanding the basic structure of an HTML document and its common tags is essential for anyone starting their web development journey. With practice, these tags enable developers to create well-organized, interactive, and visually appealing websites. Beyond the basics, exploring lesser-known and advanced elements such as <template>, <canvas>, and semantic HTML5 tags allows you to craft richer, more accessible experiences. By mastering HTML, you build a solid base for exploring advanced web technologies and frameworks, paving the way for professional and creative web development projects. Keep experimenting, stay updated with evolving standards, and your HTML skills will remain a powerful asset in crafting modern, high-quality websites.

Get in touch for customized mentorship, research and freelance solutions tailored to your needs.

bottom of page