Markup Language

HTML

HTML is the markup language that gives every web page its structure and meaning. Here's what it is, how it works, and how to start using it today.

beginner14 min readUpdated Sep 13, 2026
html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My first page</title>
  </head>
  <body>
    <h1>Hello, world!</h1>
    <p>I am learning <strong>HTML</strong>.</p>
  </body>
</html>
Full name
HyperText Markup Language
Created by
Tim Berners-Lee, 1991
Type
Markup language
Standard
WHATWG Living Standard
File extension
.html
Current version
HTML5 (living)

Hands-on

Try HTML live

Edit the HTML on the left — the preview updates instantly.

Try HTML live

Edit the HTML on the left — the preview updates instantly.

Why it matters

The foundation of everything on the web

Accessibility

Semantic HTML is what screen readers and keyboards rely on. Good markup is the difference between a page everyone can use and one that is broken for millions.

Search engines

Search engines read your HTML to understand your content. A clear heading structure and meaningful metadata are the foundation of ranking.

Performance

Lean, semantic markup parses faster, styles more easily and is simpler to maintain — smaller pages and happier users.

The big picture

The three pillars of the web

Every page is built from three languages working together. HTML comes first because it is the structure the other two attach to.

HTML

Structure

Content and meaning — headings, paragraphs, links, images and forms.

CSS

Presentation

Look and layout — colour, spacing, typography and responsive design.

JavaScript

Behaviour

Interactivity — responding to clicks, fetching data and updating the page.

HTML5 at a glance

What modern HTML gives you

Semantic elements

header, nav, article, section, aside, footer and main.

Native media

Built-in audio and video — no plugins required.

Graphics

canvas and inline SVG for 2D and vector graphics.

Smarter forms

New input types with built-in validation.

JavaScript APIs

Storage, geolocation, drag and drop, and offline support.

Better structure

Landmarks and semantics for accessible, searchable pages.

A short history

From 18 tags to a living standard

  1. 1991

    The first web page

    Tim Berners-Lee invents HTML at CERN with around 18 tags.

    91
  2. 1995

    HTML 2.0

    The first standard formalises the early language.

    95
  3. 1999

    HTML 4.01

    Stylesheets arrive and structure separates from presentation.

    99
  4. 2014

    HTML5

    Semantic elements, native media and powerful APIs ship.

    14
  5. Today

    Living standard

    Updated continuously by the WHATWG instead of in versions.

    Today

The complete guide

HTML: Everything you need to know

What is HTML?

HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. Every page you have ever visited — from a simple personal blog to a complex web application — is built on HTML.

The name says a lot. HyperText means text that links to other text, the idea that made the web possible: documents connected by links. Markup means you wrap content in tags that describe what it is. Language means there are rules and a shared vocabulary — though HTML is not a programming language.

When you write HTML you are describing the structure and meaning of a document: which part is a heading, which is a paragraph, which is a navigation menu, where an image goes and how a form is laid out. The browser reads your HTML and turns it into the page people see. Nothing on the web exists without it.

The best way to think about HTML is as the skeleton of a page. It decides that there is a heading here, a paragraph there, an image, a link and a form — but it says nothing about colour, size or position. That separation is deliberate: structure belongs to HTML, appearance belongs to CSS and behaviour belongs to JavaScript. Because each layer has one job, pages stay easier to build, test and maintain, and a change to the design never forces you to rewrite your content.

How HTML works

HTML is made of elements. An element is a piece of content wrapped in tags. A tag is written between angle brackets, and most elements have an opening and a closing tag:

// index.html
<p class="intro">Hello, world!</p>

Breaking that down:

  • <p> is the opening tag and </p> is the closing tag.
  • p is the element name — a paragraph.
  • class="intro" is an attribute: extra information about the element.
  • Hello, world! is the content.

Some elements are void elements with no content and no closing tag, such as <img>, <br>, <input> and <meta>. Others nest inside each other to form a tree, which is exactly what the browser builds as it parses your file.

When a browser loads an HTML file it parses the markup from top to bottom and builds the DOM (Document Object Model) — a tree of objects representing your page. CSS then styles that tree, and JavaScript can read and modify it. That is the whole web platform in one sentence.

Because the DOM is a tree, every element has a parent and can have children. The <body> element contains your headings and paragraphs, and each of those can contain links, images and text. When JavaScript later adds or removes an element, it is editing this same tree — which is why understanding the DOM makes the rest of frontend development much easier.

The anatomy of an HTML document

Every HTML page follows the same basic skeleton:

// index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>My first page</title>
  </head>
  <body>
    <h1>Hello, world!</h1>
    <p>I am learning <strong>HTML</strong>.</p>
  </body>
</html>

Each part has a job:

  • <!doctype html> tells the browser to use standards mode.
  • <html lang="en"> is the root element; the lang attribute declares the page language for screen readers and search engines.
  • <head> holds metadata that is not displayed — character set, viewport, title and links to CSS.
  • <title> is the name shown in the browser tab and in search results.
  • <body> contains everything the user actually sees.

Writing your first HTML page

The fastest way to understand HTML is to write it. Create a file called index.html, paste the skeleton above, and open it in your browser. You have just built a web page.

From there, build up one element at a time:

  1. Add an <h1> for your page title and a <p> for an introduction.
  2. Add a link with <a href="https://example.com">Example</a>.
  3. Add an image with <img src="photo.jpg" alt="A description" />.
  4. Group content with <header>, <main> and <footer>.
  5. Open the file again — the browser updates instantly with every save.

You do not need any tools, frameworks or build step to start. A text editor and a browser are enough. That low barrier is exactly why HTML is the best first language for anyone entering web development.

Semantic HTML: the difference between a div and an article

You can build an entire page out of <div> elements, but you should not. Semantic HTML means choosing elements that describe their meaning:

  • <header>, <nav>, <main>, <aside>, <footer> — page landmarks.
  • <article> — a self-contained piece of content.
  • <section> — a thematic grouping of content.
  • <figure> and <figcaption> — media with a caption.
  • <time>, <mark>, <address> — content with a specific meaning.

Compare a vague structure:

<!-- bad.html -->
<div class="header">
  <div class="nav">...</div>
</div>
<div class="content">
  <div class="post">...</div>
</div>

with a semantic one:

<!-- good.html -->
<header>
  <nav>...</nav>
</header>
<main>
  <article>...</article>
</main>

They can look identical, but the semantic version tells screen readers, search engines and other developers exactly what each part is. It is one of the highest-leverage habits in frontend development, and it costs nothing to adopt from day one.

HTML forms and user input

Forms are how users send data to a server — logins, searches, checkouts and sign-ups. The <form> element wraps inputs, and <label> connects a description to each control:

<!-- subscribe.html -->
<form action="/subscribe" method="post">
  <label for="email">Email address</label>
  <input id="email" name="email" type="email" required />
  <button type="submit">Subscribe</button>
</form>

HTML5 added many input types — email, url, number, date, range, color, search — plus built-in validation attributes such as required, minlength, pattern and min/max. Always pair inputs with labels: it is required for accessibility and makes forms usable with a keyboard and a screen reader.

HTML vs HTML5

Feature HTML (4.01) HTML5
Semantic tags Limited header, nav, article, section, aside, footer, main
Media Plugins required Native <audio> and <video>
Graphics None <canvas> and <svg>
Input types Basic email, date, range, color and more
APIs Minimal Storage, geolocation, drag & drop, offline
Doctype Long and complex Simple <!doctype html>

Accessibility and SEO start with HTML

Two of the most important goals in web development are decided largely by your HTML.

Accessibility depends on meaningful markup: a logical heading order, alt text on images, labels on form controls, landmark elements and sufficient contrast. Assistive technology navigates your page the same way a search engine reads it — through the structure. A screen reader user can jump between landmarks and headings precisely because the HTML says what each region is.

SEO starts with HTML too. A single descriptive <h1>, a well-written <title> and meta description, descriptive link text, structured data, and fast, crawlable markup all help search engines understand and rank your content. No amount of JavaScript fixes a page with broken HTML semantics.

Best practices

Good HTML is not about memorising tags — it is about choosing the right element for the job and keeping the document clean. These habits take seconds to apply and pay off for the life of a project:

  • Use semantic elements instead of <div> soup.
  • Keep one <h1> per page and never skip heading levels.
  • Always set lang on <html>.
  • Add meaningful alt text to images, and use alt="" for purely decorative ones.
  • Connect every form control to a <label>.
  • Use descriptive link text — never “click here”.
  • Validate your markup with the W3C validator.
  • Prefer progressive enhancement: the page should work before JavaScript.
  • Keep the document structure shallow and readable.

Common mistakes

  • Building everything with <div> and <span>.
  • Multiple <h1>s or skipped heading levels.
  • Missing or lazy alt text.
  • Vague link text such as “read more”.
  • Using deprecated tags like <center> and <font>.
  • Forgetting the lang attribute.
  • Heavy inline styles instead of CSS.
  • Unlabelled form inputs.

Is HTML still worth learning in 2026?

Absolutely. HTML is not going anywhere. Every framework — React, Vue, Svelte, Astro and Next.js — ultimately renders HTML that the browser displays, so when you write a component you are still describing structure. Developers who understand HTML write more accessible, faster and more search-friendly interfaces, because they know which element to reach for instead of rebuilding everything from generic containers. As a first language it is also unbeatable: you can see results within minutes, with no tooling or build step, and every later skill in web development builds on the foundation it gives you. Learn it properly once and you will use it for the rest of your career.

How to learn HTML

HTML is the easiest web technology to start and one of the easiest to underestimate. A practical path:

  1. Learn the document skeleton and the most common elements.
  2. Build a simple page with headings, paragraphs, links, lists and images.
  3. Learn semantic elements and use them in real layouts.
  4. Practise forms, labels and validation.
  5. Study accessibility basics and audit your pages.
  6. Validate your HTML and fix the warnings.
  7. Build small projects — a profile page, a blog layout, a landing page — until the tags feel automatic.

From there, move on to CSS, then JavaScript, then a framework. Our interactive HTML tutorial walks you through every step with hands-on exercises.

Choosing elements

Use the element that describes what the content is. Semantic elements give browsers, screen readers and search engines structure that a generic div cannot.

Prefer
<header>
  <nav>...</nav>
</header>
<main>
  <article>
    <h1>Title</h1>
    <p>Body text.</p>
  </article>
</main>
<footer>...</footer>
Avoid
<div class="header">
  <div class="nav">...</div>
</div>
<div class="main">
  <div class="post">
    <div class="title">Title</div>
    <div class="text">Body text.</div>
  </div>
</div>

Writing alt text

Alt text describes the purpose of an image for people who cannot see it. Describe the content, keep it short, and use an empty alt for purely decorative images.

Prefer
<img src="sales.png"
     alt="Sales rose 20% in 2025" />

<img src="divider.svg" alt="" />
Avoid
<img src="sales.png" />
<img src="sales.png" alt="image" />
<img src="sales.png" alt="sales.png" />

FAQ

Frequently asked questions

Keep learning

Related topics from the roadmap.

$ start learning

Ready to start learning HTML Basics?

Our interactive tutorial walks you through HTML Basics step by step — with quizzes and real code you can run in the browser.