Skip to content
SiteShiftCo

HTML

HyperText Markup Language, the standard markup language for creating web pages, defining structure and meaning of content through elements and attributes.

Also known as: HyperText Markup Language, HTML5

HTML (HyperText Markup Language) is the standard markup language used to create web pages. It defines the structure and semantic meaning of content, headings, paragraphs, links, images, lists, forms, and other elements, using tags wrapped in angle brackets. HTML is one of the three core technologies of the web alongside CSS (for visual styling) and JavaScript (for interactivity).

The current standard is HTML5, an evolving specification maintained by WHATWG (Web Hypertext Application Technology Working Group).

Basic structure

A minimal HTML document:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Page title</title>
</head>
<body>
  <h1>Welcome</h1>
  <p>This is a paragraph.</p>
</body>
</html>

Each component:

  • <!DOCTYPE html>, declares the document type
  • <html>, root element
  • <head>, metadata, links to stylesheets, scripts, page title
  • <body>, visible content
  • <h1>, <p>, content elements

Common HTML elements

ElementPurpose
<h1> to <h6>Headings (six levels)
<p>Paragraph
<a>Hyperlink
<img>Image
<ul>, <ol>, <li>Lists (unordered, ordered, item)
<table>, <tr>, <td>, <th>Tables
<form>, <input>, <button>, <select>, <textarea>Form controls
<div>Generic container with no semantic meaning
<span>Generic inline container
<header>, <footer>, <nav>, <main>, <article>, <section>, <aside>Semantic structural elements
<video>, <audio>Media
<svg>Scalable vector graphics
<canvas>Drawing surface for JavaScript
<script>JavaScript code or reference
<link>External resource (typically stylesheets)
<meta>Metadata (character set, viewport, descriptions)

Semantic HTML

HTML elements are not just visual containers, they convey meaning. Semantic HTML uses elements according to their intended purpose:

  • A <button> indicates an interactive control
  • A <nav> indicates a navigation section
  • An <article> indicates self-contained content
  • A <header> indicates introductory content

Semantic markup matters for:

  • Accessibility. Screen readers and assistive technologies rely on semantic meaning
  • SEO. Search engines use structural elements to understand page content
  • Maintainability. Code is easier to read and modify when its purpose is explicit
  • Browser features. Some elements have built-in behavior (e.g., <details> collapses by default)

Using <div> for everything (sometimes called “div soup”) loses these benefits.

HTML attributes

Attributes provide additional information about elements:

<a href="https://example.com" target="_blank" rel="noopener">Link</a>
<img src="photo.jpg" alt="A descriptive caption" width="600" height="400" />
<input type="email" name="email" required placeholder="Your email" />

Common attributes:

  • id, unique identifier
  • class, one or more class names for CSS or JavaScript targeting
  • href, link destination
  • src, source for images, scripts, iframes
  • alt, alternative text for images
  • title, tooltip text
  • data-*, custom data attributes for application use
  • aria-*, accessibility attributes
  • style, inline CSS (generally avoided in favor of stylesheets)

How HTML is processed

When a browser receives an HTML document:

  1. It parses the HTML into a Document Object Model (DOM) tree
  2. It fetches and applies linked stylesheets and scripts
  3. It computes layout and renders the visible page
  4. It executes JavaScript that modifies the DOM
  5. It responds to user interactions, updating the DOM as needed

JavaScript can read and modify the DOM, enabling interactive behavior.

HTML versions

VersionReleasedNotes
HTML 1.01993Initial public version
HTML 4.011999Long-running standard
XHTML 1.02000Stricter, XML-based variant
HTML52014Major modernization; new elements, APIs
HTML Living StandardOngoingContinuously updated by WHATWG

The current state of HTML is best described as a Living Standard maintained by WHATWG; “HTML5” is sometimes used to refer to the broader modern web platform including new APIs.

HTML beyond the browser

HTML is also used:

  • In emails. Email clients render a subset of HTML for formatted email
  • In RSS and Atom feeds. Article content is often HTML
  • In ebooks. EPUB format uses XHTML
  • In offline documentation. Many documentation tools generate HTML
  • In static site generators. HTML is the output format
  • In server-rendered applications. Most server-side frameworks produce HTML

Validating HTML

HTML can be validated against the specification using:

  • W3C Markup Validator, official validator
  • Browser DevTools, Chrome, Firefox highlight some issues in the inspector
  • Editor extensions, most code editors validate HTML in real time
  • Linters, automated tools (htmlhint, ESLint with HTML plugins)

Valid HTML is more reliably rendered by all browsers and assistive technologies; invalid HTML often works but may behave inconsistently.

Common misconceptions

  • “HTML is a programming language.” HTML is a markup language; it describes structure but does not perform computation. JavaScript is the programming language used in browsers.
  • “You need to learn HTML to make a website.” Many platforms (Squarespace, Wix, WordPress with page builders) generate HTML for users; learning HTML is needed for direct control or custom-coded sites.
  • “HTML is obsolete.” HTML is the foundation of every web page; the standard continues to evolve.
  • “Semantic HTML is just for screen readers.” It also affects SEO, code clarity, and behavior of assistive technologies, search bots, and browser features.