diffsnack
Knowledge · public, no sign-up

Understand what you read.

Every card in the game is based on one idea. Here each one is explained for beginners: what happens, why, and how it is done right. You can read everything without playing.

All exercises with solutions →

Follow the HTML course step by step →

Glossaryfrom scratch

What does <h1> actually mean?

All 235 terms the magnifier explains in the game: tags, attributes and special characters, each with an example.

HTMLBasics

The HTML skeleton

Every HTML page has the same basic frame. It tells the browser what kind of file this is and splits it into an invisible head and a visible body.

HTMLHead

charset, viewport and title

A few lines in the head decide how the page looks on phones and in the browser tab. Visitors never see these lines on the page itself.

HTMLBasics

Comments the browser ignores

A comment is a note for people who read the code. The browser skips it and never shows it on the page.

HTMLText

Headings are an outline

Headings <h1> to <h6> build a table of contents for the page. The number is the level in the outline, not just a font size.

HTMLBasics

Opening and closing tags

Most HTML elements have an opening tag and a closing tag around their content. The closing tag has a slash and must use the same name.

HTMLText

strong and em

<strong> and <em> give words extra meaning inside a sentence. Browsers show them in bold and in italics by default.

HTMLText

Lists with ul, ol and li

HTML has two common kinds of lists. <ul> shows bullet points, and <ol> shows numbers.

HTMLText

Special characters

Some characters are written as short codes called entities. The browser shows the real character instead of the code.

HTMLLinks

Links and paths

The href of a link says where it goes. It can be a full address or a path that starts from the current page.

HTMLLinks

Jump links with #id

A link can jump to a place on the same page. It uses # plus the id of the target element.

HTMLLinks

Opening links in a new tab

target="_blank" asks the browser to open a link in a new tab. rel adds safety rules for that new tab.

HTMLImages

Images: alt, width and height

An <img> needs a few attributes to work well for everyone. alt describes the image, and width and height keep space for it.

HTMLInteractive

Buttons, links and details

Links take you somewhere, and buttons do something on the current page. <details> is a fold-out box that works without any script.

HTMLHead

Loading CSS

The design of a page usually lives in a separate CSS file. A <link> in the head connects that file to the page.

HTMLAccessibility

Names for screen readers

Screen readers read the page out loud. Some elements need an extra name, and some decoration should be skipped.

HTMLText

Spaces and line breaks

By default, the browser shows extra spaces and line breaks in text as one space. To break a line or keep spaces, use <br>, <pre> or &nbsp;.

HTMLText

Quotes, code and dates

HTML has small tags that say what a piece of text is: a quote, some code, a date or an abbreviation. Browsers style some of them by default, and machines can read them.

HTMLText

Nested and description lists

An ordered or unordered list can hold another list inside one of its <li> items. For pairs like "Price: CHF 80", HTML has the description list <dl>.

HTMLBasics

Page layout: header, main and footer

Elements like <header>, <nav>, <main> and <footer> name the big parts of a page. They look like plain blocks, but they tell screen readers and search engines what each part is.

HTMLHead

Description, link previews and favicon

Some tags in the <head> are never shown on the page. They give search engines a short description, suggest a preview to chat apps, and point the browser to the small tab icon.

HTMLBasics

Attribute basics

Attributes are extra settings written inside an opening tag, like href="lessons.html". Small mistakes in them, like a missing quote, can break a whole line of the page.

HTMLImages

Figures, picture and media

<figure> groups an image with its caption, and <picture> offers the browser several image files to choose from. <video> and <audio> play media, and controls adds the browser's built-in play buttons.

HTMLText

Tables for rows and columns

A table shows data in rows and columns, like a price list or a size chart. It is built row by row: <tr> makes a row, <th> a heading cell and <td> a normal cell.

HTMLInteractive

Form fields and labels

A <form> collects fields like <input> and <select> and sends them when you tap its submit button. Each field should have a <label> so people and screen readers know what to type.

HTMLInteractive

Form checks by the browser

By default, the browser checks a form when it is submitted, without any JavaScript. It looks at attributes like required and at the field type, such as email.

HTMLInteractive

Content the browser hides

Some HTML is in the file but not on the screen until something shows it. hidden, <template>, a closed <dialog> and <noscript> all hide content in different ways.

HTMLText

Highlights, edits and small text

HTML has inline tags for highlighted text, edits, outdated info, footnotes and fine print. Browsers give each one a default look so readers can spot its role quickly.

HTMLHead

Canonical links and robots meta

Two optional tags in the <head> give instructions to search engines. A canonical link names the preferred URL of a page, and a robots meta tag can ask search engines not to index it.

HTMLLinks

Download links and file links

An <a> link can point to a file like a PDF instead of another web page. Adding the download attribute asks the browser to save a same-site file rather than opening it in the tab.

HTMLInteractive

Input types and controls

The type attribute on <input> tells the browser what kind of control to show. Depending on the type, browsers can hide characters, show a slider or date picker, or pick a matching mobile keyboard.

HTMLAccessibility

Keyboard focus and tabindex

Many visitors move through a page with the Tab key instead of a mouse or touchscreen. HTML sets a default focus order, and the tabindex attribute lets you adjust which elements can receive focus.

HTMLText

b, i and u vs strong and em

<b>, <i> and <u> style words without adding strong importance or spoken stress. Use <strong> and <em> when the meaning matters, and avoid <u> where it looks like a link.

HTMLText

kbd, samp and var for computer text

HTML has specific inline tags for keyboard input, program output and variable names. Using them makes technical instructions clearer to read and easy to style with CSS.

HTMLBasics

What may go inside what

HTML elements follow nesting rules that decide which tags may sit inside which. Breaking these rules can make the browser auto-close tags or move elements around.

HTMLHead

Loading JavaScript with script

A <script> tag loads JavaScript so a page can become interactive. Attributes like defer, async and type="module" control when and how the file runs.

HTMLBasics

article, section and aside

HTML has three tags for grouping content inside a page: <article>, <section>, and <aside>. Picking the right one tells browsers and screen readers how each block relates to the rest of the page.

HTMLLinks

Link rel values

The rel attribute on <a> describes how the linked page relates to the current page. You can combine several keywords by separating them with spaces.

HTMLImages

Video captions with track

The <track> element adds timed text such as captions or subtitles to a <video> or <audio> player. It points to a WebVTT (.vtt) file and tells the browser what kind of text it is and which language it uses.

HTMLAccessibility

Table headers with scope

A table can have headings along the top row and along the left column. Adding scope to each <th> tells browsers and screen readers whether that heading labels a column or a row.

HTMLInteractive

textarea and datalist

Use <textarea> for multi-line messages and <datalist> to offer autocomplete suggestions on an <input>. Both work with plain HTML and need no JavaScript.

HTMLInteractive

Popovers without JavaScript

The popover attribute hides a box until a button opens it on top of the page. With popovertarget, you can wire up tips, menus and notices using plain HTML.