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

Text, links and images

Most of the web is text, links and pictures. Let's master all three.

Headings

HTML has six heading levels. <h1> is the main title (use one per page), and <h2>–<h6> create sections and subsections.

HTML · CSS · live preview
Preview

Choose headings by meaning, not size. Never skip from <h2> to <h4> just because it looks smaller. Size is CSS's job. Screen-reader users and search engines navigate pages by their heading structure.

Paragraphs and text formatting

HTML · CSS · live preview
Preview

<strong> and <em> carry meaning. Use <b> and <i> only when you want the look without the importance.

Links

The <a> (anchor) element creates hyperlinks, the "HT" in HTML.

HTML · CSS · live preview
Preview
href type Example Goes to
Absolute URL https://site.com/page Any website
Relative path about.html, ../img/logo.png A file relative to the current page
Root-relative /blog/post-1 From the root of your site
Fragment #contact An element with id="contact" on the page

Write meaningful link text. "Read our pricing guide" is useful; "click here" isn't. Screen-reader users often jump from link to link and hear only the link text.

Images

HTML · CSS · live preview
Preview
  • src: where the image file is.
  • alt: a text alternative. It's read by screen readers, shown if the image fails to load, and used by search engines. It's required. For purely decorative images, use alt="".
  • width/height: reserve space so the page doesn't jump around while the image loads.

Try breaking the src URL to see the alt text appear.

Images with captions

HTML · CSS · live preview
Preview

Image formats

Format Best for
JPEG Photos
PNG Graphics with transparency, screenshots
SVG Logos and icons (vector, so they stay sharp at any size)
WebP / AVIF Modern formats: much smaller files for photos and graphics

Practice

Create a mini "favourite place" article: an <h1>, an image with good alt text inside a <figure> with a caption, a paragraph with at least one <strong> word, and a link to learn more that opens in a new tab.

HTML · CSS · live preview
Preview
✎ Check your understanding

1.What is the alt attribute for?

2.How do you link to the element <section id="faq"> on the same page?

← Your first web page