What is HTML?

How a browser turns markup into a page.

HTML (HyperText Markup Language) describes the structure of a page. A browser reads an HTML document from top to bottom and builds a tree of elements called the DOM, then paints it on screen.

Every HTML element is written as a tag, usually paired with a closing tag:

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

The browser doesn't care about indentation or line breaks in your source — it only cares about the tags and the text between them.

Note

Tags describe what something is, not how it looks. Visual styling is CSS's job, not HTML's.

Impressionist painting of the Seine in Paris, with a domed building and bridge behind the water
Images in a lesson always declare width and height so the page doesn't jump while they load.

Building a minimal page

  1. Declare the document type

    Every HTML file starts with <!DOCTYPE html>, which tells the browser to use modern rendering rules.

  2. Add the html and head elements

    <html> wraps the whole document. <head> holds metadata the visitor never sees directly, like the page title.

  3. Add the body

    <body> holds everything the visitor actually sees: text, images, buttons, forms.

Tip

You can open any web page, right-click, and choose Inspect to see its HTML tree live in your browser's dev tools.

Question 1 of 2

Which element holds the content a visitor actually sees?

  • <head>Metadata about the page
  • <body>The rendered page content
  • <html>The document root

Question 2 of 2

Which of these are HTML’s job? Select all that apply.

  • Describing structureHeadings, paragraphs, lists
  • Giving content meaningSemantics for browsers and screen readers
  • Setting colors and spacingVisual styling
  • Storing data on a serverBackend persistence

Try it yourself

Edit the HTML, CSS, and JS below, then press Run to see the result.

Playground

Files

Press Escape, then Tab, to move on from the editor.

Preview

Preview stopped.

Press Run to preview your code.

Console

No output yet.

Challenge

Add a level-one heading with the id title containing the text Hello, HTML.

Challenge

Files

Press Escape, then Tab, to move on from the editor.

Preview

Preview stopped.

Press Run to preview your code.

Console

No output yet.