HTML Tags

Beginner
14 min read
Updated: Nov 2026
6 examples
HTML5 elements

Definition and Usage

HTML tags are the building blocks of every webpage. Written in angle brackets, they mark up headings, paragraphs, links, images, forms, and page regions so the browser—and assistive tools—know what each piece of content is.

Tag vs element

A tag is the syntax (<p>, </p>). An element is the complete unit: opening tag, content, and closing tag (or a void tag like <img>). Tutorials often use both words for the same idea.

What should beginners learn first?

Start with the page shell (html, head, body), text (h1–h6, p), links and images (a, img), lists, a simple form, and semantic layout (header / nav / main / footer. Then open individual guides from the sidebar.

Hub vs single-tag pages

This page teaches how tags work in an HTML tutorial. Each name in the reference tables links to a focused tag page (for example HTML a Tag). For outdated markup, see Deprecated Tags; for name="value" settings, see HTML Attributes.

Meaning over look.

Tags describe structure and meaning. Use CSS for colors, fonts, and layout.

Close what you open.

Mismatching or crossing tags breaks the tree. Close inner elements before outer ones.

Prefer semantics.

Reach for header, nav, main, and article before wrapping everything in div.

HTML Syntax

A normal element has an opening tag, content, and a closing tag:

HTML
<p class="intro">Hello, world!</p>

Void elements stand alone (no closing tag, no children):

HTML
<br>
<img src="photo.jpg" alt="A sunset">
<input type="text" name="email">
<meta charset="UTF-8">

Nesting must stay layered—close the inner tag first:

HTML
<!-- Valid -->
<p><strong>Bold</strong></p>

<!-- Invalid: crossed tags -->
<p><strong>Bold</p></strong>

Core HTML Concepts

Ideas that unlock the rest of the tag catalog:

ConceptWhat it means
Opening / closing<tag> … </tag> wrap content
Void elementsNo end tag: img, br, input, meta…
AttributesExtra settings on the opening tag (Attributes hub)
Semantic tagsName the role: nav, main, article
Generic containersdiv / span when no better tag fits

Tag categories (quick map)

CategoryExamples
Document shellhtml, head, body, title, meta
Texth1–h6, p, em, strong, code
Links & mediaa, img, audio, video, iframe
Lists & tablesul/ol/li, table/tr/td
Formsform, input, label, button, select
Page regionsheader, nav, main, section, footer

Semantic instead of div soup

Instead ofPrefer
<div class="header"><header>
<div class="nav"><nav>
<div id="content"><main>
<div class="post"><article>
<div class="footer"><footer>

How to Build Pages with HTML Tags

A practical beginner workflow:

  1. Start every file with <!DOCTYPE html> and an <html lang="…"> root.
  2. Put metadata in head; put visible content in body.
  3. Outline the page with headings, then paragraphs, lists, and links.
  4. Add images with meaningful alt; wrap forms with label + controls.
  5. Use semantic landmarks (header, nav, main, footer) for layout regions.
  6. Open a single-tag guide when you need attributes or edge cases for one element.

Live Preview

A tiny semantic page using header, nav, main, and footer—the same idea as Example 6.

Landmarks help browsers and screen readers understand page regions.

Preview
Site title

Welcome

This content lives in <main> inside an <article>.

© CodeToFun — footer landmark

HTML Examples

Six starter patterns: skeleton, headings, link/image, list, form, and a semantic page.

Example 1 — Minimal HTML5 Skeleton

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My First Page</title>
</head>
<body>
  <h1>Hello HTML</h1>
  <p>Every page needs doctype, html, head, and body.</p>
</body>
</html>
Try It Yourself

How It Works

  1. DOCTYPE puts the browser in standards mode.
  2. head holds charset, viewport, and title.
  3. body holds everything users see.
  4. lang helps accessibility and translation tools.

Example 2 — Headings and Paragraph

HTML
<h1>Page title</h1>
<p>Intro paragraph under the main heading.</p>
<h2>Section title</h2>
<p>More detail in this section.</p>
Try It Yourself

How It Works

  1. h1 is the top-level page title (usually one).
  2. h2–h6 nest sections without skipping levels.
  3. p wraps normal body text.
  4. Outline matters for screen readers and SEO.

Example 4 — Unordered List

HTML
<h2>Core tags</h2>
<ul>
  <li><code>p</code> for paragraphs</li>
  <li><code>a</code> for links</li>
  <li><code>img</code> for images</li>
</ul>
Try It Yourself

How It Works

  1. ul is an unordered (bulleted) list.
  2. li is each list item (direct child of ul/ol).
  3. ol is the numbered alternative.
  4. code marks inline code names.

Example 5 — Simple Contact Form

HTML
<form action="/contact" method="post">
  <label for="name">Name</label>
  <input type="text" id="name" name="name" required>

  <label for="msg">Message</label>
  <textarea id="msg" name="msg" rows="3" required></textarea>

  <button type="submit">Send</button>
</form>
Try It Yourself

How It Works

  1. form groups controls for submission.
  2. label for matches the control id.
  3. input is void; textarea wraps text.
  4. button type="submit" sends the form.

Example 6 — Semantic Page Layout

HTML
<header>
  <h1>My Site</h1>
  <nav>
    <a href="/">Home</a>
    <a href="/about">About</a>
  </nav>
</header>
<main>
  <article>
    <h2>Welcome</h2>
    <p>Main content goes here.</p>
  </article>
</main>
<footer>
  <p>&copy; 2026</p>
</footer>
Try It Yourself

How It Works

  1. header / nav introduce branding and links.
  2. main is the unique primary content (one per page).
  3. article is a self-contained unit inside main.
  4. footer closes the page landmark set.

HTML5 Tags Reference

Common tags by category. Each name links to its dedicated tutorial in the sidebar catalog.

Document & metadata

TagPurpose
<!DOCTYPE html>Declares HTML5 document type
<html>Root element of the page
<head>Metadata container
<body>Visible page content
<title>Document title (browser tab)
<meta>Charset, viewport, and other metadata
<link>External CSS / icons
<style>Embedded CSS
<script>JavaScript
<base>Base URL for relative links
<template>Inert HTML for cloning
<noscript>Fallback when scripts are off
<!-- -->Developer comments

Sectioning & layout

TagPurpose
<header>Intro / nav group
<nav>Navigation links
<main>Primary unique content
<section>Thematic grouping
<article>Self-contained composition
<aside>Sidebar / related content
<footer>Footer for page or section
<div>Generic block container
<span>Generic inline container
<address>Contact information

Text & phrasing

TagPurpose
<h1–h6>Heading levels
<p>Paragraph
<br>Line break (void)
<hr>Thematic break (void)
<pre>Preformatted text
<blockquote>Long quotation
<em>Emphasis
<strong>Strong importance
<code>Inline code
<a>Hyperlink
<abbr>Abbreviation
<mark>Highlight
<time>Date / time
<del>Deleted text
<ins>Inserted text

Lists

TagPurpose
<ul>Unordered list
<ol>Ordered list
<li>List item
<dl>Description list
<dt>Term
<dd>Description

Links & media

TagPurpose
<img>Image (void)
<picture>Responsive images
<audio>Audio player
<video>Video player
<source>Media source (void)
<track>Text track (void)
<iframe>Embedded browsing context
<svg>Inline SVG
<canvas>Bitmap drawing surface
<map>Image map
<area>Map hotspot (void)

Tables

TagPurpose
<table>Table container
<caption>Table title
<thead>Header rows
<tbody>Body rows
<tfoot>Footer rows
<tr>Row
<th>Header cell
<td>Data cell
<colgroup>Column group
<col>Column (void)

Forms

TagPurpose
<form>Form container
<input>Input control (void)
<textarea>Multi-line text
<button>Button
<select>Dropdown
<option>Option
<optgroup>Option group
<label>Control caption
<fieldset>Grouped controls
<legend>Fieldset caption
<datalist>Suggestions
<output>Result display
<meter>Gauge
<progress>Progress bar

Interactive & figures

TagPurpose
<figure>Illustration / diagram
<figcaption>Figure caption
<details>Disclosure widget
<summary>Details summary
<dialog>Dialog box

Common void elements

Void tagUse
<br>Line break
<hr>Thematic break
<img>Image
<input>Form control
<meta>Metadata
<link>Stylesheet / icon
<source>Media source
<wbr>Word-break opportunity

Full A–Z browsing: use the left sidebar, or start at Deprecated Tags / <a>.

Edge Cases & Pitfalls

Most beginner tag bugs are nesting mistakes or using div for everything.

nest

Crossed closing tags

Browsers guess repairs when you close the outer tag first. Always close innermost first.

void

Closing void elements

Do not write <br></br> or wrap content in <img>.

h

Skipping heading levels

Jumping from h1 to h4 confuses outlines. Use sequential levels.

div

Div soup

Prefer landmarks and articles. Keep div/span for when no semantic tag fits.

main

Multiple <main>

Use one main per page. Extra regions should be section or article.

table

Tables for layout

Use CSS Flexbox/Grid for page layout; reserve tables for data.

Browser Support

Core HTML tags are Baseline web platform features. Semantic elements (header, nav, main, article) and everyday tags (p, a, img, form) work in all modern browsers.

✓ Baseline · Widely available

HTML tags

Standard HTML elements are among the most stable parts of the web.

100% core HTML tags
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
HTML tags Universal

Bottom line: Write valid nested tags, prefer semantics, and open individual tag guides for deep attributes.

Key Takeaways

  • Tags mark meaning; CSS handles appearance.
  • Pair open/close tags; void tags never wrap children.
  • Semantic landmarks beat anonymous div layouts.
  • Next: Deprecated Tags or <a>; configure with Attributes.

One line: HTML tags name each piece of content—nest them correctly, prefer semantics, then dive into single-tag guides.

Frequently Asked Questions

A tag is a keyword in angle brackets that starts or ends an element—for example <p> opens a paragraph and </p> closes it. Tags tell the browser what each piece of content is.
A tag is the markup syntax (<p>, </p>). An element is the whole unit: opening tag, optional content, and closing tag—or a void tag like <br>.
Void elements have no closing tag and no children—br, img, input, meta, link, hr, and similar. Write them as <br> or <br />; both are valid in HTML5.
Choose by meaning, not look. Use header/nav/main/article for structure, p for paragraphs, a for links, ul/ol/li for lists. Prefer semantic tags over wrapping everything in div.
Most do. Void elements never close. Some tags can omit end tags in HTML, but writing them explicitly is clearer for beginners.
Browse individual tag guides in the sidebar (start with Deprecated Tags or the a tag), or continue to HTML Attributes to configure elements.

Practice in the editor

Open a Try It demo and build a semantic page from scratch.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful