HTML Tutorial for Beginners
Learn HTML from the very beginning. Build real pages with headings, links, images, tables, forms, SVG and responsive layouts, and run every example right here in your browser.
Browse all 44 lessons by stage
- Lessons
- 44
- Live examples
- 116
- Exercises
- 235
- Quiz questions
- 182
HTML course at a glance
Who it's for
Complete beginners, students, designers, bloggers and anyone who wants to understand how web pages are built.
Prerequisites
None. If you can use a browser and type, you can start the first lesson today.
What you need
A modern browser. Every example runs on the page, and a code editor such as VS Code is useful for your own files.
How long it takes
About two weeks for the Basics and Intermediate stages at an hour a day, and four to six weeks for the full course.
HTML roadmap: beginner to advanced
Follow the chapters in order, because each one builds on the last. Every lesson has live examples, exercises and a quiz.
Basics
Your first page, tags, attributes, text, links, file paths, images, lists, colours and buttons.
- 1HTML IntroductionWhat HTML is, how browsers read it, and your very first web page.
- 2HTML EditorsSet up VS Code, save an .html file and open it in your browser.
- 3Page StructureThe DOCTYPE, html, head and body elements that every web page is built on.
- 4Elements & TagsStart tags, end tags, nesting and empty (void) elements.
- 5AttributesGive elements extra information with name="value" pairs.
- 6HeadingsUse h1 to h6 to give your page a clear outline for readers and Google.
Show all 17 lessonsShow fewer
- 7Paragraphs & BreaksParagraphs, line breaks, dividers and how HTML handles spaces.
- 8Text FormattingBold, italic, highlighted, deleted and code text, chosen for meaning.
- 9Quotes & CitationsMark up quotes, sources, abbreviations and contact details with the right HTML elements so browsers, search engines and screen readers understand them.
- 10Code & Preformatted TextDisplay code snippets, keyboard shortcuts, program output and variables correctly with code, pre, kbd, samp and var, and escape special characters.
- 11CommentsLeave notes in your code and switch parts off without deleting them.
- 12Colors & StylesChange text and background colours with the style attribute, write colours as names, HEX, RGB and HSL values, and learn when inline styles are the right tool.
- 13LinksLink to other pages, sections, emails and phone numbers.
- 14File Paths & URLsLink to pages, images, styles and scripts correctly with relative and absolute paths, root-relative URLs and the base element, and fix broken links.
- 15ImagesAdd pictures with img, write great alt text and keep pages fast.
- 16ListsBullet lists, numbered lists, nested lists and description lists.
- 17ButtonsCreate accessible buttons with the button element, choose the right type, disable buttons, add icons and labels, and know when a link is the better choice.
Intermediate
Tables, forms and validation, containers, attributes, semantic structure, layout and embeds.
- 18TablesShow data in rows and columns with headers, captions and merged cells.
- 19FormsCollect information from visitors with accessible, well-labelled forms.
- 20Form ControlsBuild complete forms with labels, dropdown lists, multi-line text boxes, grouped radio buttons and checkboxes, suggestion lists and output fields.
- 21Input TypesThe right input type gives better phone keyboards, pickers and built-in checks.
- 22Form ValidationCheck user input before it's sent with built-in validation attributes such as required, minlength, pattern, min and max, style valid and invalid fields, and use form attributes like action, method and autocomplete.
- 23Div, Span & Block/InlineWhy some elements stack and others flow, and the two generic containers.
Show all 14 lessonsShow fewer
- 24Classes & IDsName elements so CSS and JavaScript can find them.
- 25Data AttributesStore extra information on elements with data-* attributes, read and change it with JavaScript's dataset, and style elements by their data values with CSS attribute selectors.
- 26Semantic ElementsStructure pages with elements that describe what each part is.
- 27Page LayoutPlan and build a complete web page layout with header, nav, main, article, aside and footer, then arrange it with simple, responsive CSS.
- 28IframesEmbed videos, maps and other web pages inside your page.
- 29Embedding ContentEmbed YouTube videos, maps, PDFs and other content safely and responsively with iframe, object and embed, using privacy-friendly and fast-loading techniques.
- 30Entities & SymbolsShow reserved characters like < and &, special symbols and emoji.
- 31Figure, Time & ProgressUse the small, meaningful HTML elements that make content richer: figure and figcaption for captioned media, time for dates, mark for highlights, and progress and meter for bars.
Advanced
Media, canvas, scripting, SEO, accessibility, responsive design, performance, and best practices.
- 32Audio & VideoPlay video and sound natively with controls, posters and captions.
- 33CanvasDraw graphics with the canvas element and JavaScript: rectangles, lines, circles, text and images, with colours and gradients, and learn when canvas is the right choice.
- 34SVGDraw sharp, scalable graphics with inline SVG: shapes, paths, text and viewBox, style them with CSS, build accessible icons and choose between SVG files and inline SVG.
- 35Scripts in HTMLAdd JavaScript to a page correctly with the script element, choose between inline and external scripts, load them without slowing the page using defer, async and modules, and provide noscript fallbacks.
- 36Head & Meta TagsThe invisible tags that control SEO, social sharing and loading.
- 37SEO Meta & SchemaHelp pages rank and look good when shared: write title tags and meta descriptions, set canonical URLs, add Open Graph and Twitter cards, favicons and JSON-LD structured data.
Show all 13 lessonsShow fewer
- 38AccessibilityBuild pages everyone can use, including screen-reader and keyboard users.
- 39Responsive ImagesServe the right image size and format to every screen.
- 40Responsive DesignMake pages work on every screen: the viewport meta tag, fluid images and video, responsive tables, mobile-friendly forms and navigation, and testing on phones.
- 41Page SpeedMake pages load faster with HTML alone: lazy-load images and iframes, set image sizes to stop layout shifts, preload key files, preconnect to other servers and load scripts without blocking.
- 42Details & DialogBuild accordions, FAQs, popups and progress bars with plain HTML.
- 43HTML5 APIsUse powerful browser features built into HTML: the Popover API for menus and tooltips without JavaScript, drag and drop, the Geolocation API, and the contenteditable attribute.
- 44Best PracticesWrite clean, valid, professional HTML: a style guide for naming and formatting, validating pages, character encoding and URL encoding, and a checklist to review any page.
What is HTML?
HTML (HyperText Markup Language) is the language that describes what is on a web page: the headings, paragraphs, links, images, buttons and forms. Every website you have ever visited, from search engines to your favourite game wiki, is built on HTML.
HTML is not a programming language. It doesn't do maths or make decisions. Instead it marks up content so the browser knows what each piece is: "this is a heading", "this is a link", "this is a list". That makes it the easiest place to start coding, and you'll see your first results within minutes.
This tutorial takes you from your very first tag to complete, accessible pages. Each lesson explains one topic in plain English, shows working examples you can edit, and ends with exercises and a short quiz so you can check your understanding before moving on.
Once you know HTML, you add CSS to make pages look good and JavaScript to make them interactive.
A short history of HTML
HTML was created by Tim Berners-Lee, a scientist at CERN in Switzerland, as part of his proposal for the World Wide Web. In 1989 he wanted a simple way for researchers to share documents that could link to each other, wherever those documents were stored. By the end of 1990 he had written the first web browser, the first web server and the first pages, and in 1991 he published a short list of around eighteen tags. Several of them, such as <p>, <a> and <h1> to <h6>, are still used on every page today.
As the web grew, browser makers added their own tags, and pages often looked different from one browser to the next. Standards were written to bring order: HTML 2.0 in 1995, then HTML 3.2 and HTML 4.01 from the World Wide Web Consortium (W3C) in 1997 and 1999. HTML 4.01 separated content from presentation by moving styling into CSS, which is still how the web works.
In 2004, a group of browser makers formed the WHATWG to create a practical successor focused on web applications. Their work became HTML5, which added semantic elements such as <header>, <nav> and <article>, native audio and video, the canvas element, new form input types and much more. HTML5 became a W3C Recommendation in 2014, and in 2019 the two groups agreed that the WHATWG "living standard" would be the single version of HTML. Instead of big numbered releases, HTML now improves continuously, which is why recent features like the dialog element and popovers simply appear in browsers when they are ready.
How the course is organised
The 44 lessons are split into three stages. Basics (17 lessons) takes you from an empty file to a real page with headings, text, links, images, lists and buttons. Intermediate (14 lessons) covers tables, forms and validation, layout containers and the semantic elements that give a page its structure. Advanced (13 lessons) adds media, canvas, SVG, scripts, SEO meta tags, accessibility, responsive images, performance and modern browser APIs.
Each stage builds on the one before it, so work through the lessons in order. You'll write a complete page early in the Basics stage, and every lesson after that adds one more tool to it.
How to follow this course
Plan for one lesson per study session. Read the explanation, run each example, then change it: swap the text, add another element, remove a closing tag and see what the browser does. Those small experiments teach you more than reading alone, because you see exactly how HTML behaves when something is missing or out of place.
Finish every lesson with its exercises and quiz before moving on. At the end of each stage, build something small of your own, such as a recipe page, a profile card or a page about a hobby. The guided projects give you a starting point with clear requirements and a full solution to compare against.
Why HTML still matters
It's tempting to skip straight to frameworks, but every framework still produces HTML in the end. Developers who understand HTML well build pages that load faster, work with screen readers and keyboards, rank better in search results and need far less CSS and JavaScript to fix problems. Good HTML is also the foundation of accessibility: choosing a real <button> instead of a clickable <div> gives you keyboard support, focus handling and screen reader labels without writing a single line of script.
HTML is a skill you'll use in every web role, from frontend development and email design to content management, technical writing and SEO.
What you will learn
10 practical skills, built one lesson at a time
- Write a complete HTML page from scratch
- Use headings, paragraphs, lists, links and images correctly
- Build tables and accessible forms that collect user input
- Structure pages with semantic elements like header, nav and main
- Add audio, video, YouTube embeds, canvas drawings and SVG graphics
- Build page layouts that work on every screen size
- Write SEO meta tags, structured data and fast-loading pages
- Validate your HTML and use browser APIs like popovers and drag and drop
- Write accessible markup that works for everyone
- Avoid the mistakes beginners make most often
Practise HTML your way
Learning sticks when you use it. Pick a mode.
HTML Exercises
Fill in blanks, predict output and fix broken code with instant feedback.
235 exercisesHTML Quiz
5, 10 or 20 questions with a timer and explanations after every answer.
182 questionsHTML Cheat Sheet
Every important piece of syntax on one printable page.
Open cheat sheetCode Playground
A full HTML, CSS and JavaScript editor with live preview and console.
Open playgroundBuild projects with HTML
Real mini-projects with starter code, steps and a full solution.
Personal Profile Card
A clean, shareable profile card with a photo, name, bio, skills and social links.
Recipe Web Page
A well-structured, good-looking recipe page with an image, ingredients, steps and a facts table.
Tip Calculator
Split a bill between friends with live tip buttons. Your first real interactive app.
To-Do List App
Add, complete, delete and filter tasks, saved in the browser so they survive a refresh.
Digital Clock & Greeting
A live clock with date, a 12/24-hour toggle and a greeting that changes with the time of day.
Colour Palette Generator
Generate random harmonious palettes, lock favourites, copy HEX codes and press Space for new colours.
HTML FAQ
How long does it take to learn HTML?
Most beginners learn the core of HTML in one to two weeks with about an hour a day. The Basics stage takes a weekend. Real confidence comes from building small projects.
Is HTML a programming language?
No. HTML is a markup language. It describes the structure and meaning of content, but it has no logic such as loops or conditions. That logic comes from JavaScript.
Do I need to install anything to learn HTML?
No. Every example on this site runs in your browser. When you want to build pages on your own computer, all you need is a text editor such as VS Code. The HTML editors lesson shows you how to set it up.
Should I learn HTML or CSS first?
HTML first. CSS styles HTML, so you need something to style. Finish the basics here, then start the CSS tutorial.
What is the latest version of HTML?
HTML is now a "living standard" maintained by the WHATWG, and it's still often called HTML5. There are no more numbered versions. New features are added gradually, and everything taught here is current.
Can I build a website with only HTML?
Yes. A page written only in HTML works in every browser and can include text, links, images, tables, forms and video. It will look plain, though. Most real websites add CSS for design and JavaScript for interactive features, and this course prepares you for both.
What is the difference between HTML and HTML5?
HTML5 is the name for the modern version of HTML. It added semantic elements such as <header> and <article>, native audio and video, canvas, new input types and better form validation. Today there is a single living standard, so "HTML" and "HTML5" usually mean the same thing.
Why does semantic HTML matter?
Semantic elements describe what content is, not how it looks. Search engines use them to understand your page, screen readers use them to help people navigate, and other developers find your code easier to read. The semantic elements lesson in the Intermediate stage shows how to choose the right element for each part of a page.
Is HTML enough to get a job?
HTML on its own is rarely enough for a developer role, but it is required for every frontend job and many related roles such as email development, content editing and SEO. Most people learn HTML, CSS and JavaScript together, which is exactly the order the learning paths follow.
How do I publish my HTML page online?
Save your page as an .html file, then upload it to a hosting service. GitHub Pages is a popular choice for learners because it publishes a website straight from a repository. The GitHub course walks you through it step by step.
More tutorials
CSS
Colours, fonts, spacing and layouts that make pages beautiful.
Start CSSJavaScript
The programming language that makes web pages interactive.
Start JavaScriptPython
A friendly first programming language for scripts, data and automation.
Start PythonJava
A reliable, widely used language for apps, Android and big systems.
Start JavaKotlin
The modern language for Android apps, servers and multiplatform code.
Start KotlinSwift
Apple's fast, safe language for iPhone, iPad, Mac and SwiftUI apps.
Start Swift