Cheatsheets

HTML Cheatsheet

Use this HTML cheatsheet to choose semantic tags, structure headings and sections, write accessible links, images, lists, tables and forms, then copy clean markup examples into your page.

Quick reference

Document structure

Page root<!doctype html>
Language<html lang="en">
Metadata<meta name="description" content="...">
Viewport<meta name="viewport" content="width=device-width, initial-scale=1">

Semantic elements

Header<header>
Navigation<nav aria-label="Main">
Main content<main>
Footer<footer>

Forms

Label<label for="email">Email</label>
Input<input id="email" type="email" required>
Textarea<textarea name="message"></textarea>
Button<button type="submit">Send</button>

Visual patterns

Compare the syntax with a small rendered example so the reference is easier to scan and remember.

Headings and paragraphs

Use headings to describe hierarchy, then support them with readable text.

HTMLHTML
<h1>Page heading</h1>
<h2>Section heading</h2>
<p>Paragraph text gives the heading useful context.</p>
Live preview

Page heading

Section heading

Paragraph text gives the heading useful context.

Links and images

Use descriptive link text and meaningful image alt text.

HTMLHTML
<img src="preview.png" alt="Dashboard preview">
<a href="/guide">Read the guide</a>
CSSCSS
img {
  max-width: 100%;
  border-radius: 14px;
}

a {
  color: #2563eb;
  text-decoration: underline;
}
Live preview
Unordered and ordered lists

Use unordered lists for groups and ordered lists for sequences.

HTMLHTML
<ul>
  <li>Plan content</li>
  <li>Write markup</li>
  <li>Check semantics</li>
</ul>
Live preview
List type
  • Plan content
  • Write markup
  • Check semantics
Tables

Tables are for tabular data, not page layout.

HTMLHTML
<table>
  <thead>
    <tr><th>Tag</th><th>Use</th></tr>
  </thead>
  <tbody>
    <tr><td>th</td><td>Header cell</td></tr>
    <tr><td>td</td><td>Data cell</td></tr>
  </tbody>
</table>
CSSCSS
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid #dbe3ec;
  padding: 10px;
}
Live preview
TagUse
thHeader cell
tdData cell
Forms

Pair labels and controls so forms work for screen readers and click targets.

HTMLHTML
<label for="email">Email</label>
<input id="email" type="email" placeholder="you@example.com">
<button type="submit">Subscribe</button>
CSSCSS
label {
  display: block;
  font-weight: 700;
}

input,
button {
  min-height: 42px;
}
Live preview
Semantic layout

Use landmark elements to make page structure easier to understand.

HTMLHTML
<header>Header</header>
<nav aria-label="Main">Navigation</nav>
<main>Main content</main>
<aside>Related</aside>
<footer>Footer</footer>
Live preview
header
main
footer

Learn the pattern

Short notes to help you decide when to use each pattern, avoid common mistakes and copy the examples with confidence.

When to use

  • Use HTML to describe structure and meaning before styling.
  • Use semantic landmarks for page regions users navigate repeatedly.
  • Use tables only for real tabular data.

Quick tips

  • Write link text that makes sense out of context.
  • Pair every visible input with a label.
  • Use one main element for the primary page content.

Common mistakes

  • Using divs for every section when semantic tags would help.
  • Leaving image alt text empty when the image communicates content.
  • Using links for actions that should be buttons.

Best practices

  • Choose elements by meaning first and appearance second.
  • Keep forms keyboard friendly and easy to scan.
  • Validate generated markup before copying it into production.

Examples

CodeBasic page skeleton
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Page title</title>
  </head>
  <body>
    <main>Content</main>
  </body>
</html>

HTML FAQ

What is included in the HTML cheatsheet?

HTML Cheatsheet includes quick reference sections, practical examples, common mistakes, tips and links to related DevKitYard tools.

Is the HTML cheatsheet interactive?

Yes. This cheatsheet includes visual examples with copyable code and lightweight controls where interaction helps explain the pattern.

When should I use this HTML reference?

Use it when you need to recall syntax, compare common patterns or avoid mistakes without opening a long tutorial.

What should I use after reading this cheatsheet?

Use related DevKitYard tools such as HTML Formatter, Meta Tag Generator, HTML Table Builder when you need to format, validate, generate or inspect real output.