Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

HTML
HTML
0/10 completed
Beginner
Your first web pageText, links and imagesLists and tablesForms
Intermediate
Semantic HTMLAccessibility basicsSEO and meta tags
Advanced
Images, video and embedsModern HTML: dialog, details and more
Pro
Performance and best practices
Tracks / HTML / Beginner

Your first web page

Every website you've ever visited is built on HTML (HyperText Markup Language). HTML describes the structure and meaning of content: "this is a heading", "this is a paragraph", "this is a link". Browsers read HTML and turn it into the page you see.

HTML isn't a programming language. It doesn't calculate or make decisions. It's a markup language: you wrap content in tags to label what it is.

The web's three languages

Language Job Analogy
HTML Structure and content The skeleton
CSS Presentation and layout The skin and clothes
JavaScript Behaviour and interactivity The muscles

Elements and tags

HTML · CSS · live preview
Preview

The editor above is live. Change the text and the preview updates as you type.

An element usually has:

  • an opening tag: <p>
  • content: This is my very first web page.
  • a closing tag: </p> (notice the /)

Elements can be nested inside each other, like <strong> inside <p>. Close them in the reverse order you opened them.

The full document structure

A real HTML file has a standard skeleton:

HTML · CSS · live preview
Preview
Part Purpose
<!DOCTYPE html> Tells the browser "this is modern HTML5"
<html lang="en"> The root element; lang helps screen readers and search engines
<head> Information about the page (title, settings, links to CSS); not shown on the page
<meta charset="UTF-8"> Supports every language and emoji 🎉
<meta name="viewport"> Makes the page work properly on phones
<title> Text shown in the browser tab and in search results
<body> Everything visible on the page

Attributes

Attributes add extra information to an element. They go inside the opening tag as name="value".

HTML · CSS · live preview
Preview

Empty (void) elements

Some elements have no content and no closing tag:

HTML · CSS · live preview
Preview

Comments

HTML · CSS · live preview
Preview

Making it real on your computer

  1. Create a folder and a file called index.html.
  2. Paste the full skeleton from above into it, using any editor (VS Code is free and excellent).
  3. Double-click the file. It opens in your browser. That's a website!

Whitespace doesn't matter. Extra spaces and new lines collapse into a single space. Indent your code to make it readable for humans; the browser doesn't care.

Practice

Build an "About me" page with your name as an <h1>, two paragraphs about yourself, and a horizontal rule between them.

HTML · CSS · live preview
Preview
✎ Check your understanding

1.Where does content that's visible on the page go?

2.What is href in <a href="...">?