HTML Tutorial

HTML Examples

120 page fragments you can preview, including STEM lab reports, clinic forms, and data tables. Click Try it in HTML to open /html/try — a live page.

120 copy-and-run snippets. Open one in Try HTML at /html/try, change a value, and run it again. Each language has its own shelf and its own editor.

Start

Page skeleton

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Studio</title>
</head>
<body>
  <h1>Hello, HTML</h1>
</body>
</html>
Related lesson →

Language and charset

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Charset</title>
</head>
<body>
  <p>Text is UTF-8.</p>
</body>
</html>
Related lesson →

Text

Paragraphs

<p>Sourdough, tomato, olive oil.</p>
<p>Espresso until 16:00.</p>
Related lesson →

Bold and italic

<p><strong>Open</strong> today. <em>Come early.</em></p>
Related lesson →

Mark and small

<p><mark>New</mark> rye. <small>Baked at 6am.</small></p>
Related lesson →

Abbreviation

<p><abbr title="HyperText Markup Language">HTML</abbr> structures a page.</p>
Related lesson →

Background color

<p style="background:#ffedd5;padding:0.6rem">Warm paper.</p>
Related lesson →

CSS in a style tag

<style>
  h1 { color: #9a3412; }
  p { color: #57534e; }
</style>
<h1>Studio</h1>
<p>Harbor Street</p>
Related lesson →

Layout

Div group

<div style="padding:1rem;background:#ffedd5">
  <h2>Today</h2>
  <p>Tomato toast.</p>
</div>
Related lesson →

Class names

<style>.card{border:1px solid #fdba74;padding:0.8rem}</style>
<div class="card">A card with a class.</div>
Related lesson →

Id target

<h2 id="hours">Hours</h2>
<p><a href="#hours">Jump to hours</a></p>
Related lesson →

Semantic header

<header>
  <h1>Cafe menu</h1>
  <p>Harbor Street</p>
</header>
Related lesson →

Nav links

<nav>
  <a href="/html">Home</a>
  <a href="/html/forms">Forms</a>
</nav>
Related lesson →

Main and footer

<main>
  <h1>Studio</h1>
  <p>Write a page. See the page.</p>
</main>
<footer>StudyGrid HTML</footer>
Related lesson →

Two columns

<div style="display:flex;gap:1rem">
  <div>Menu</div>
  <div>Hours</div>
</div>
Related lesson →

Responsive width

<img src="https://picsum.photos/seed/wide/600/180" alt="Wide loaf" style="max-width:100%;height:auto">
Related lesson →

Viewport meta

<meta name="viewport" content="width=device-width, initial-scale=1">
<p>This page scales on a phone.</p>
Related lesson →

Forms

Simple form

<form action="#" method="get">
  <label>Name <input name="name"></label>
  <button type="submit">Send</button>
</form>
Related lesson →

Text input

<label>Email <input type="email" name="email" placeholder="you@studio.test"></label>
Related lesson →

Password input

<label>Password <input type="password" name="pw"></label>
Related lesson →

Number input

<label>Loaves <input type="number" name="n" min="1" max="12" value="2"></label>
Related lesson →

Radio buttons

<label><input type="radio" name="size" value="s"> S</label>
<label><input type="radio" name="size" value="l" checked> L</label>
Related lesson →

Select menu

<label>City
  <select name="city">
    <option>Oslo</option>
    <option selected>Lisbon</option>
  </select>
</label>
Related lesson →

Textarea

<label>Note
  <textarea name="note" rows="3">Hold the sesame.</textarea>
</label>
Related lesson →

Date input

<label>Pickup <input type="date" name="when" value="2026-08-19"></label>
Related lesson →

Range input

<label>Heat <input type="range" min="1" max="10" value="7"></label>
Related lesson →

File input

<label>Photo <input type="file" name="photo" accept="image/*"></label>
Related lesson →

Required field

<form action="#">
  <input name="name" required placeholder="Your name">
  <button>Send</button>
</form>
Related lesson →

Fieldset legend

<fieldset>
  <legend>Pickup</legend>
  <label><input type="radio" name="p" checked> Now</label>
  <label><input type="radio" name="p"> Later</label>
</fieldset>
Related lesson →

Search input

<input type="search" name="q" placeholder="Search the menu">
Related lesson →

Telephone input

<label>Phone <input type="tel" name="tel" placeholder="+47 555 12 12"></label>
Related lesson →

URL input

<label>Site <input type="url" name="url" placeholder="https://"></label>
Related lesson →

Hidden field

<form action="#">
  <input type="hidden" name="source" value="html-examples">
  <button>Book</button>
</form>
Related lesson →

Graphics and script

Canvas box

<canvas id="board" width="240" height="80" style="border:1px solid #c2410c"></canvas>
Related lesson →

Canvas draw

<canvas id="c" width="240" height="80"></canvas>
<script>
const ctx = document.getElementById("c").getContext("2d");
ctx.fillStyle = "#c2410c";
ctx.fillRect(20, 20, 80, 40);
</script>
Related lesson →

SVG circle

<svg width="120" height="80" viewBox="0 0 120 80">
  <circle cx="60" cy="40" r="28" fill="#ea580c" />
</svg>
Related lesson →

SVG rectangle

<svg width="160" height="70">
  <rect x="10" y="15" width="140" height="40" rx="8" fill="#fdba74" />
</svg>
Related lesson →

Inline script

<p id="out">…</p>
<script>
document.getElementById("out").textContent = "HTML ran a script.";
</script>
Related lesson →

Click handler

<button id="go" type="button">Mark open</button>
<p id="state">closed</p>
<script>
document.getElementById("go").onclick = () => {
  document.getElementById("state").textContent = "open";
};
</script>
Related lesson →

Local storage write

<button id="save" type="button">Remember rye</button>
<p id="out"></p>
<script>
document.getElementById("save").onclick = () => {
  localStorage.setItem("bread", "rye");
  document.getElementById("out").textContent = localStorage.getItem("bread");
};
</script>
Related lesson →

Session storage

<script>
sessionStorage.setItem("seat", "12");
document.body.insertAdjacentHTML("beforeend", "<p>Seat " + sessionStorage.getItem("seat") + "</p>");
</script>
Related lesson →

Details summary

<details>
  <summary>Allergens</summary>
  <p>Contains gluten and sesame.</p>
</details>
Related lesson →

Time element

<p>Opens <time datetime="2026-08-19T08:00">19 Aug, 08:00</time></p>
Related lesson →

Picture source

<picture>
  <source media="(max-width: 500px)" srcset="https://picsum.photos/seed/sm/240/120">
  <img src="https://picsum.photos/seed/lg/400/160" alt="Loaf">
</picture>
Related lesson →

Map area

<img src="https://picsum.photos/seed/map/240/120" alt="Shop map" usemap="#shop">
<map name="shop">
  <area shape="rect" coords="0,0,120,120" href="/html" alt="Counter">
</map>
Related lesson →

Iframe title

<iframe title="Blank note" width="240" height="100" srcdoc="<p>Inner page</p>"></iframe>
Related lesson →

Noscript

<noscript>Turn on JavaScript to try the live preview extras.</noscript>
<p>The page still has text.</p>
Related lesson →

Keyboard kbd

<p>Press <kbd>Ctrl</kbd> + <kbd>S</kbd> to save locally.</p>
Related lesson →

Output live

<form oninput="out.value = Number(a.value) + Number(b.value)">
  <input id="a" type="number" value="3"> +
  <input id="b" type="number" value="4"> =
  <output id="out" for="a b">7</output>
</form>
Related lesson →

Dialog polyfill-free

<p>Use a heading and a form instead of a native dialog for this preview.</p>
<section>
  <h2>Book a loaf</h2>
  <button type="button">Close</button>
</section>
Related lesson →

Accessible button

<button type="button" aria-pressed="false">Subscribe</button>
Related lesson →

Skip link

<a href="#content">Skip to content</a>
<main id="content"><h1>Menu</h1></main>
Related lesson →

Contenteditable

<p contenteditable="true">Edit this line in the preview.</p>
Related lesson →

Draggable text

<p draggable="true">Drag this line in a supporting browser.</p>
Related lesson →

Ol reversed

<ol reversed>
  <li>Cool</li>
  <li>Bake</li>
  <li>Proof</li>
</ol>
Related lesson →

Start attribute

<ol start="7">
  <li>Seat seven</li>
  <li>Seat eight</li>
</ol>
Related lesson →

Table colspan

<table border="1">
  <tr><th colspan="2">Cafe</th></tr>
  <tr><td>Open</td><td>8–16</td></tr>
</table>
Related lesson →

Table rowspan

<table border="1">
  <tr><th rowspan="2">Hours</th><td>Tue 8–16</td></tr>
  <tr><td>Wed 8–16</td></tr>
</table>
Related lesson →

Empty alt decorative

<p>Menu <img src="https://picsum.photos/seed/dot/16/16" alt="" width="16" height="16"> Harbor</p>
Related lesson →

STEM

Lab report outline

<h1>Free-fall write-up</h1>
<h2>Aim</h2>
<p>Measure s after 1 s, 2 s, and 3 s from rest.</p>
<h2>Results</h2>
<p>Gaps grow because speed increases.</p>
Related lesson →

Titration table

<table>
  <caption>HCl vs NaOH titres</caption>
  <tr><th>Run</th><th>mL</th></tr>
  <tr><td>1</td><td>24.8</td></tr>
  <tr><td>2</td><td>25.1</td></tr>
</table>
Related lesson →

Clinic booking

<form action="#">
  <label>Name <input name="name" required></label>
  <label>Date <input type="date" name="when"></label>
  <button>Book</button>
</form>
Related lesson →

Vitals card

<div style="background:#fef3c7;padding:0.8rem">
  <h2>Vitals</h2>
  <p>36.8 °C · 72 bpm</p>
</div>
Related lesson →

H2O with sub

<p>Water is H<sub>2</sub>O. Area 3<sup>2</sup> m<sup>2</sup>.</p>
Related lesson →

pH bands

<p style="background:#b91c1c;color:#fff;padding:0.4rem">pH 1 acid</p>
<p style="background:#166534;color:#fff;padding:0.4rem">pH 7 neutral</p>
Related lesson →

FAQ: HTML Examples

Common questions about this page.

What is the StudyGrid HTML tutorial?

The StudyGrid HTML tutorial is a full beginner track: tags, headings, links, images, tables, layout, forms, and media. Each chapter has copy-and-run examples.

Should I run html examples examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn html examples in this HTML HTML lesson (HTML Examples).

Is the HTML editor the same as Try Python?

No. Try HTML is a live page preview at /html/try. Try Python stays at /try and runs Python. HTML lessons never open the Python editor.

Do I need to install anything to learn HTML?

No. Open a chapter, click Try it in HTML, and the page preview updates in the browser. You can also download a .html file and open it locally.

Where should I start the HTML tutorial?

Start at HTML Intro, then Basic, Elements, and Attributes. After the first document, continue to headings, links, and forms. Use Next at the bottom of each chapter.

Is the HTML tutorial free?

Yes. The HTML studio on StudyGrid (studygrid.in) is free: dashboard, chapters, and the live preview editor.