Saved

Press the star next to a tool's name to save it.

All my tools

HTML Cheat Sheet

This html cheat sheet lists the HTML elements you use most, grouped into page structure, text, forms, tables and media. Search it, filter by topic or print it.

Restored your last values ·

Your search stays in your browser. Nothing is uploaded.

Commands

–

No commands match that search.

Recent results

This html cheat sheet follows the HTML elements reference on MDN Web Docs and lists the common elements by group. [1] Choosing an element for its meaning, not its looks, helps accessibility and search engines, and you can change how it looks with CSS.

How to use the html cheat sheet

  1. Type in the search box to filter by any word in a name, a command or its note.
  2. Choose a topic to see one group instead of the whole list.
  3. Read the command in the right-hand column and its meaning on the left.
  4. Press Print for a clean copy of whatever is shown.

What is in each topic

The html cheat sheet is split into 5 topics. The table shows how many entries each topic holds and which ones they are, so you can jump straight to the right group with the topic box.

TopicEntriesWhat it covers
Page structure8header; navigation; main content; article; section; sidebar; footer; headings
Text7paragraph; block container; quotation; preformatted text; bulleted list; numbered list; thematic break
Forms6form; input; button; label; dropdown; multi-line text
Tables6table; caption; header, body, footer; row; header cell; data cell
Images and media5image; responsive image; audio; video; subtitles

Page structure

Sectioning elements describe the layout of a page. header holds introductory content, nav a section of navigation links and main the dominant content of the body. article is a self-contained piece of content, section a standalone section with a heading, aside content only indirectly related to the main content and footer closing information. [1] h1 to h6 give six levels of headings, with h1 the highest. [1]

Use one h1 per page and keep heading levels in order. A page built from these elements is easier for screen readers to move around than one made only of div elements.

Text, forms and tables

p is a paragraph, div a generic block container with no meaning, blockquote an extended quotation, pre preformatted text and ul, ol and li make bulleted and numbered lists. [1] A form holds controls; input accepts data and its type attribute changes its behaviour, button performs an action, label captions a control, select with option makes a dropdown and textarea takes several lines of text. [1]

A table holds rows and columns of data: tr is a row, th a header cell, td a data cell, and thead, tbody and tfoot group rows. Use tables for data, not for page layout. [1]

Images and media

img embeds an image, and its alt text describes it for people who cannot see it. picture with source offers alternative versions of an image for different devices or formats. [1]

audio and video embed sound and a video player, and track adds timed text such as subtitles. [1] Add the controls attribute so visitors can play and pause. Check that every image has useful alt text, or an empty one when it is purely decorative.

Who this page helps

Developers use a cheat sheet to look up a command they have not typed for a while, to learn the names of the options and to compare similar commands. Beginners can read down a topic to see what is possible, and experienced users can search for the one flag they forgot.

Tips for getting the most from the html cheat sheet

  • Pick the element that describes the content, then style it with CSS to get the look you want.
  • Give every image alt text and every form control a label.
  • Keep one h1 on each page and do not skip heading levels.

Common mistakes

Most problems come from running a command in the wrong place or with the wrong target. Read a command before you press Enter, replace every placeholder with your own value, and try destructive commands on a test copy first. When a command behaves differently from the note, check the version you have installed and the official documentation.

Where the entries come from

Each command was checked against the documentation listed below this article. Where a command is standard but is not shown on the page we read, the article says it is our own working. Options and defaults change between releases, so run the help command for the version you have installed before you rely on a flag.

What this page does not do

It lists the commands most people need and does not try to cover every option. For the complete syntax, error messages and advanced features, open the official documentation linked in the sources, and keep it beside the cheat sheet while you learn.

Printing and checking

Filter by topic before you print if you only need one section, and the printed page will be shorter. The notes are short on purpose, so keep your textbook or the official documentation open for the full detail and for anything that changes between versions.

What next

Use this often? Add HTML Cheat S to your Home screen.

Frequently asked questions

What does this html cheat sheet include?

The common elements for page structure, text, lists, forms, tables, images, audio and video, each with a short description.

How many heading levels does HTML have?

Six, from h1 to h6, with h1 the highest. Use them in order and keep one h1 on each page.

What is the difference between div and section?

A div is a generic container with no meaning. A section is a standalone part of a document and normally has a heading.

Why does an img need alt text?

The alt attribute describes the image for screen readers and shows if the image fails to load.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools