Post Title
May 15, 2025
Content here.
Every HTML element and attribute, searchable and copy-ready, with live previews.
By Bogdan SanduUpdated August 4, 2026
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header><nav></nav></header>
<main><h1>Heading</h1></main>
<footer></footer>
<script src="app.js" defer></script>
</body>
</html><!DOCTYPE html><html lang="en"> … </html><head> … </head><body> … </body><!-- This is a comment --><div class="container"> … </div>Rendered
<span class="highlight">text</span>Rendered
<h1>Main Title</h1>Rendered
Main Title
<h2>Section</h2> <h3>Sub</h3> <h4>…</h4>Rendered
Section Title
Subsection
<!-- Avoid: <center>text</center> -->
<p style="text-align:center">Centered text</p>Rendered
Use CSS instead
<!-- Avoid: <font color="red">Text</font> -->
<span style="color:red;font-size:1.2rem">Text</span>Rendered
<!-- Avoid: <strike>text</strike> -->
<del>Removed content</del>Rendered
<!-- Removed. Use iframe instead: -->
<iframe src="page.html" title="Content"></iframe><!-- Avoid: <marquee>text</marquee> -->
/* Use CSS animation instead */<p>This is a paragraph.</p>Rendered
This is a paragraph of text content.
<br>Rendered
<hr>Rendered
<strong>Important text</strong>Rendered
<b>Bold text</b>Rendered
<em>Emphasized text</em>Rendered
<i>Italic text</i>Rendered
<code>const x = 42;</code>Rendered
const x = 42; to declare a constant.<pre><code>
function hello() {
return "hi";
}
</code></pre>Rendered
function hello() {\n return "hi";\n}<del>$99</del> <ins>$49</ins>Rendered
E = mc<sup>2</sup> H<sub>2</sub>ORendered
<blockquote cite="https://source.com">
Quote text here.
</blockquote>Rendered
Quote text here.
<abbr title="HyperText Markup Language">HTML</abbr>Rendered
<mark>highlighted text</mark>Rendered
<kbd>Ctrl</kbd> + <kbd>C</kbd>Rendered
<details>
<summary>Click to expand</summary>
<p>Hidden content revealed.</p>
</details>Rendered
Hidden content revealed.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>Rendered
<a href="https://example.com">Link text</a>Rendered
<a href="https://example.com" target="_blank"
rel="noopener noreferrer">External</a><a href="mailto:hello@example.com">Email us</a><a href="tel:+15551234567">Call us</a><a href="#section-id">Go to section</a>
<section id="section-id">…</section><a href="file.pdf" download="report.pdf">Download PDF</a><a href="https://example.com/blog/post">Full URL</a><a href="/about">About page</a><a href="contact.html">Same folder</a>
<a href="../index.html">Parent folder</a><script src="//cdn.example.com/lib.js"></script><img src="photo.jpg" alt="Description" width="400" height="300"><img src="img.jpg" alt="Photo"
srcset="img-480.jpg 480w, img-800.jpg 800w"
sizes="(max-width:600px) 480px, 800px"><picture>
<source media="(min-width:800px)" srcset="large.jpg">
<source media="(min-width:400px)" srcset="medium.jpg">
<img src="small.jpg" alt="Responsive">
</picture><figure>
<img src="chart.png" alt="Sales chart">
<figcaption>Q3 Sales Data</figcaption>
</figure>Rendered
<img src="photo.jpg" alt="Photo" loading="lazy"><ul>
<li>Item one</li>
<li>Item two</li>
</ul>Rendered
<ol>
<li>First</li>
<li>Second</li>
</ol>Rendered
<ol start="5">
<li>Fifth item</li>
<li>Sixth item</li>
</ol>Rendered
<ul>
<li>Parent
<ul>
<li>Child</li>
</ul>
</li>
</ul>Rendered
<table>
<caption>Table Caption</caption>
<thead>
<tr><th>Name</th><th>Age</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>28</td></tr>
</tbody>
<tfoot>
<tr><td colspan="2">Footer</td></tr>
</tfoot>
</table>Rendered
| Name | Age | City |
|---|---|---|
| Alice | 28 | Paris |
| Bob | 34 | Tokyo |
| Footer | ||
<td colspan="2">Spans two columns</td>Rendered
| Spanning Header | |
|---|---|
| Cell 1 | Cell 2 |
<td rowspan="2">Spans two rows</td><th scope="col">Column Header</th>
<th scope="row">Row Header</th><form action="/submit" method="post">
…
</form><label for="name">Name</label>
<input type="text" id="name" name="name" placeholder="Your name">Rendered
<fieldset>
<legend>Shipping Address</legend>
<label for="city">City</label>
<input type="text" id="city" name="city">
</fieldset>Rendered
<textarea name="message" rows="4" placeholder="Your message"></textarea>Rendered
<select name="country">
<option value="">Choose…</option>
<option value="us">United States</option>
<option value="uk">United Kingdom</option>
</select>Rendered
<input type="checkbox" id="agree" name="agree">
<label for="agree">I agree to the terms</label>Rendered
<input type="radio" id="r1" name="color" value="red">
<label for="r1">Red</label>
<input type="radio" id="r2" name="color" value="blue">
<label for="r2">Blue</label>Rendered
<input type="range" min="0" max="100" value="50" name="vol">Rendered
<input type="color" name="bg" value="#22d3ee">Rendered
<progress value="70" max="100">70%</progress>Rendered
<input list="fruits" name="fruit">
<datalist id="fruits">
<option value="Apple">
<option value="Banana">
</datalist><button type="submit">Submit</button>
<button type="reset">Reset</button>Rendered
<input type="text" name="username">Rendered
<input type="email" name="email">Rendered
<input type="password" name="pass" autocomplete="current-password">Rendered
<input type="number" name="qty" min="1" max="99" value="1">Rendered
<input type="tel" name="phone" placeholder="+1 555 000 0000"><input type="url" name="website" placeholder="https://"><input type="search" name="q" placeholder="Search…">Rendered
<input type="date" name="dob">Rendered
<input type="time" name="appt">Rendered
<input type="datetime-local" name="meeting"><input type="file" name="doc" accept=".pdf,.docx" multiple><input type="hidden" name="csrf_token" value="abc123"><input type="email" name="email" required><input type="text" value="Read-only" disabled>Rendered
<input type="text" value="Fixed value" readonly><input type="text" pattern="[A-Za-z]{3,}" title="At least 3 letters"><input type="number" min="0" max="10" step="0.5">Rendered
<input type="email" autocomplete="email"><video controls width="640" height="360" poster="thumb.jpg">
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
Your browser does not support video.
</video><video autoplay muted loop playsinline>
<source src="bg.mp4" type="video/mp4">
</video><iframe width="560" height="315"
src="https://www.youtube.com/embed/VIDEO_ID"
title="Video title"
allow="accelerometer; autoplay; clipboard-write;
encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe><audio controls>
<source src="audio.mp3" type="audio/mpeg">
<source src="audio.ogg" type="audio/ogg">
Your browser does not support audio.
</audio><svg width="100" height="100" viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="40" fill="#22d3ee"/>
</svg>Rendered
<canvas id="myCanvas" width="400" height="200">
Fallback for browsers without canvas.
</canvas><header>
<nav>…</nav>
</header><nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>Rendered
<main id="main-content">
…
</main><article>
<h2>Post Title</h2>
<time datetime="2025-05-15">May 15, 2025</time>
<p>Content here.</p>
</article>Rendered
Post Title
May 15, 2025
Content here.
<section aria-labelledby="feat-heading">
<h2 id="feat-heading">Features</h2>
…
</section>Rendered
Features
Thematic content group
<aside>
<h3>Related Links</h3>
<ul>…</ul>
</aside>Rendered
<footer>
<p>© 2025 Company Name</p>
</footer><time datetime="2025-05-15T09:00">May 15, 2025</time>Rendered
<button aria-label="Close dialog">×</button><span aria-hidden="true">🔥</span><div role="alert">Form submitted!</div>
<div role="button" tabindex="0">Click me</div><button aria-expanded="false" aria-controls="menu">Menu</button>
<ul id="menu" hidden>…</ul><a href="#main-content" class="skip-link">
Skip to main content
</a><dialog id="myDialog">
<h2>Dialog Title</h2>
<p>Dialog content here.</p>
<button onclick="this.closest('dialog').close()">Close</button>
</dialog>
<button onclick="myDialog.showModal()">Open Dialog</button>Rendered
dialog::backdrop {
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(4px);
}<template id="card-tpl">
<div class="card">
<h3 class="card-title"></h3>
<p class="card-body"></p>
</div>
</template>
<script>
const tpl = document.getElementById('card-tpl');
const clone = tpl.content.cloneNode(true);
clone.querySelector('.card-title').textContent = 'Hello';
document.body.appendChild(clone);
</script><!-- Inside shadow DOM template -->
<div class="card">
<slot name="title">Default Title</slot>
<slot>Default body content</slot>
</div>
<!-- Consumer usage -->
<my-card>
<h2 slot="title">Custom Title</h2>
<p>Custom body content.</p>
</my-card>class MyCard extends HTMLElement {
constructor() {
super();
const shadow = this.attachShadow({ mode: 'open' });
const tpl = document.getElementById('my-card-tpl');
shadow.appendChild(tpl.content.cloneNode(true));
}
}
customElements.define('my-card', MyCard);<form oninput="result.value = +a.value + +b.value">
<input type="number" id="a" value="0"> +
<input type="number" id="b" value="0"> =
<output name="result" for="a b">0</output>
</form><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="A clear description under 160 chars."><meta name="author" content="Jane Doe"><meta name="robots" content="index, follow">
<meta name="robots" content="noindex, "><link rel="canonical" href="https://example.com/page"><meta property="og:title" content="Page Title">
<meta property="og:description" content="Page description.">
<meta property="og:image" content="https://example.com/og.jpg">
<meta property="og:url" content="https://example.com/page">
<meta property="og:type" content="website"><meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Description.">
<meta name="twitter:image" content="https://example.com/og.jpg"><link rel="stylesheet" href="styles.css"><link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.svg" type="image/svg+xml"><script src="app.js" defer></script><script src="analytics.js" async></script><link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin><div id="unique-id">…</div><div class="card card--featured">…</div><p style="color:red;font-weight:bold;">Alert</p>Rendered
Alert
<span title="Tooltip text">Hover me</span>Rendered
<p lang="fr">Bonjour le monde</p><div tabindex="0">Keyboard-focusable div</div><div data-user-id="42" data-role="admin">…</div>
<!-- JS: el.dataset.userId → "42" --><div contenteditable="true">Click to edit.</div>Rendered
<p hidden>Not visible until hidden is removed</p><p dir="rtl">مرحبا بالعالم</p>Rendered
مرحبا بالعالم
< >Rendered
&© ™ ®Rendered
– — …Rendered
← → ↑ ↓ ↔Rendered
× ÷ ± ≠ ≤ ≥Rendered
Nothing matches. Try a single word.
An HTML cheat sheet is a structured reference document that lists HTML tags, attributes, and syntax in one place for fast lookup.
It covers the full set of HTML5 elements in active use: document structure tags, text formatting, forms, tables, media, and semantic layout elements.
Who uses it: beginners building their first web page, and working developers who need a quick syntax check without digging through full documentation.
This is not a replacement for MDN Web Docs or the W3C HTML specification. It is a quick reference for the markup language syntax you already know but occasionally forget.
According to the Stack Overflow Developer Survey 2025, HTML/CSS is used by 61.9% of developers worldwide, making it the second most-used language group after JavaScript. Having that syntax close at hand matters.
Every valid HTML document requires 4 foundational tags before any content can be rendered: <!DOCTYPE html>, <html>, <head>, and <body>.
The WebAIM Million report (2026) found that 93.2% of the top 1 million home pages now use a valid HTML5 doctype, up from 79.1% in 2021. Pages without a valid doctype average fewer than half the elements of those with one.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<!-- content here -->
</body>
</html>
<!DOCTYPE html> goes on line 1, before anything else. No exceptions.
The lang attribute on <html> sets the document language. Screen readers and search engines both use it. Skipping it is a common oversight that affects accessibility scoring.
|
Tag |
Attribute |
Purpose |
|---|---|---|
|
|
|
Character encoding, supports all languages |
|
|
|
Controls mobile rendering |
|
|
|
Search result snippet text |
|
|
(content) |
Browser tab label and primary SERP title |
Placement rule: charset and viewport go first inside <head>, before any other tags.
The <link> tag connects external stylesheets. The <script> tag loads JavaScript. Both can go in <head> or just before </body>, depending on load order requirements.
HTML has 2 distinct categories of text tags: block-level elements that start on a new line and take full width, and inline elements that flow within surrounding text.
Mixing these up causes layout bugs that can be tricky to debug, especially when nesting inline elements inside other inline elements.
Headings: <h1> through <h6>, with <h1> reserved for the main page topic and <h2>–<h6> for subsections in descending importance.
Paragraph and break:
<p> - standard paragraph block
<br> - line break (void element, no closing tag)
<hr> - horizontal rule, thematic section divider
Quotation blocks:
<blockquote> - extended quote from external source
<pre> - preformatted text, preserves whitespace and line breaks
Semantic emphasis:
<strong> - strong importance (bold by default)
<em> - stress emphasis (italic by default)
<mark> - highlighted or relevant text
<del> - deleted content
<ins> - inserted content
Less obvious but useful:
<abbr title="HyperText Markup Language">HTML</abbr> - abbreviation with tooltip
<cite> - title of a creative work
<q> - short inline quotation (adds quotation marks automatically)
<sub> and <sup> - subscript and superscript
W3C guidance distinguishes <b> and <i> (stylistic only) from <strong> and <em> (semantic meaning). Use semantic versions by default.
5 tags handle code and technical content, each with a specific role:
<code> - inline code snippet
<pre> - block of preformatted text, usually wraps <code>
<kbd> - keyboard input (user-typed keys)
<samp> - sample output from a program
<var> - variable in math or programming context
Most developers only use <code> and <pre>. The other 3 carry semantic meaning that helps search engines and screen readers interpret technical content correctly.
HTML has 3 list types: unordered lists, ordered lists, and description lists. Each serves a different structural purpose.
Unordered list (<ul>) renders bullet points by default. Each item uses <li>.
Ordered list (<ol>) numbers items automatically. The type attribute controls numbering style:
|
|
Output |
|---|---|
|
|
1, 2, 3 |
|
|
A, B, C |
|
|
a, b, c |
|
|
I, II, III |
|
|
i, ii, iii |
Lists nest inside each other naturally. An <li> can contain another <ul> or <ol>, creating sub-levels with no extra attributes needed.
<dl>, <dt>, and <dd> build definition or key-value layouts.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language, the structure layer of the web</dd>
</dl>
Useful for glossaries, metadata displays, and FAQ-style layouts where each term has one or more associated descriptions. Most developers overlook this list type entirely.
The anchor tag <a> is the single most important element in HTML for connecting content. It handles every link type: external URLs, internal pages, section jumps, email, and phone calls.
|
Attribute |
Value example |
What it does |
|---|---|---|
|
|
|
Destination URL |
|
|
|
Opens in new tab |
|
|
|
Security for external links |
|
|
|
Forces file download |
Security note: target="_blank" without rel="noopener noreferrer" exposes the originating page to manipulation via the window.opener object. Always pair them.
5 link patterns cover nearly every use case:
External URL: <a href="https://example.com">Visit site</a>
Internal page: <a href="/about">About us</a>
Page section: <a href="#contact">Jump to contact</a>
Email: <a href="mailto:hello@example.com">Email us</a>
Phone: <a href="tel:+15551234567">Call us</a>
The <nav> element wraps groups of navigation links. It signals to assistive technologies and search engines that a section contains primary navigation, not just a list of links. The 2025 Web Almanac reports the native <main> element now appears on 47% of pages, up 3% from 2024, reflecting gradual improvement in semantic structure adoption overall.
4 tag categories handle visual and audio-visual content in HTML: images, figures, audio/video, and iframes.
<img> is a void element. It has no closing tag. Every <img> needs at minimum src and alt.
Core attributes:
src - image file path or URL
alt - text description (required for accessibility and search indexing)
width / height - prevents layout shift during load
loading="lazy" - defers off-screen image loading
WebAIM 2025 data shows 55.4% of images still lack alt text, down from 68% in 2019. Progress is slow. Every missing alt attribute is a direct accessibility and SEO failure.
<figure> wraps an image with its caption. <figcaption> sits inside <figure>.
<figure>
<img src="chart.png" alt="Q4 revenue by region">
<figcaption>Q4 2024 revenue breakdown across 5 regions</figcaption>
</figure>
<audio> and <video> share a similar attribute pattern:
controls - shows browser-native playback UI
autoplay - starts on load (use sparingly, bad UX)
loop - repeats after finishing
muted - required for autoplay to work in most browsers
poster (video only) - thumbnail shown before playback starts
Both support the <source> child element for providing multiple formats with fallback:
<video controls width="640">
<source src="intro.webm" type="video/webm">
<source src="intro.mp4" type="video/mp4">
</video>
<iframe> embeds external content: maps, videos, third-party widgets.
Required attributes: src, width, height, title (for accessibility), and allowfullscreen when embedding video players.
The title attribute on <iframe> is frequently skipped. Screen readers announce iframe content to users. Without a descriptive title, the embedded content has no accessible label.
A complete HTML table uses 7 elements: <table>, <thead>, <tbody>, <tfoot>, <tr>, <th>, and <td>.
Skipping <thead> and <tbody> works visually but breaks screen reader table navigation and makes the DOM harder to parse.
|
Element |
Role |
|---|---|
|
|
Container for the entire table |
|
|
Groups header rows |
|
|
Groups body/data rows |
|
|
Groups footer rows (totals, summaries) |
|
|
Single row |
|
|
Header cell (bold, centered by default) |
|
|
Data cell |
|
|
Visible table title, improves accessibility |
colspan merges cells horizontally. rowspan merges cells vertically.
<td colspan="2">Spans two columns</td>
<td rowspan="3">Spans three rows</td>
The scope attribute on <th> tells screen readers which cells a header applies to:
scope="col" - header for the entire column below
scope="row" - header for the entire row to the right
scope="colgroup" / scope="rowgroup" - header spans multiple columns or rows
<caption> is placed immediately after <table>. Only about 1.6% of desktop sites include table captions (Web Almanac 2025), despite captions being one of the most straightforward accessibility improvements available.
CSS handles table layout now. Using <table> for page layout (not data) is a legacy pattern. Add role="presentation" if a layout table absolutely cannot be removed.
Forms are where HTML does real work. A <form> element wraps all input controls and defines where and how collected data gets sent.
State of HTML 2023 data shows the most-used HTML input types across surveyed developers: number at 94%, email at 89%, file at 88%, and date at 83%.
The 3 form structure tags every form needs:
<form> - container; action sets where data goes, method sets how (GET or POST)
<fieldset> - groups related inputs; <legend> labels the group for screen readers
<label> - connects text to its input via the for attribute, matching the input's id
WebAIM 2025 found 34.2% of form inputs are not properly labeled, covering 6.3 form inputs per home page on average.
HTML currently supports 22 input types. The ones you'll reach for most often:
|
Type |
Use case |
|---|---|
|
|
Default single-line text |
|
|
Email with built-in format validation |
|
|
Masked text input |
|
|
Numeric input with step controls |
|
|
Boolean selection |
|
|
Single-choice from a group |
|
|
File upload dialog |
|
|
Date picker |
|
|
Slider control |
|
|
Data sent with form but not shown to users |
|
|
Form submission button |
Built-in HTML5 validation handles most common input rules without JavaScript.
required - field must have a value before submission.
pattern - validates input against a regex string.
min / max - numeric and date range boundaries.
maxlength - caps character count for text inputs.
placeholder - hint text inside the input, not a substitute for <label>.
A common mistake: using placeholder as the only label. It disappears the moment a user starts typing, leaving no visible description.
4 elements handle dropdown and multi-option scenarios:
<select> with <option> items builds a dropdown
<optgroup> clusters related options inside a <select>
<datalist> provides autocomplete suggestions for a text input (linked via list attribute)
<textarea> handles multi-line text; use rows and cols or CSS for sizing
<button type="submit"> submits the form. <button type="reset"> clears all inputs. <button type="button"> does nothing by default but triggers JavaScript handlers.
Semantic HTML5 tags define page layout regions. They replace generic <div> elements with tags that carry built-in meaning for browsers, assistive technologies, and search engines.
The <main> element now appears on 42.6% of home pages, up from 39.1% in 2024, according to WebAIM 2025. Still less than half. Most pages are still using non-semantic wrappers for primary content.
<header> - introductory content or a group of navigational links. Can appear once at page level or inside <article> and <section> elements.
<footer> - closing content: copyright, author info, related links. Same nesting rules as <header>.
<main> - the dominant content of the document. Only one <main> per page.
<nav> - primary navigation links. Not every group of links qualifies; use it for major navigation blocks only.
<aside> - content tangentially related to the surrounding context, like sidebars or pull quotes.
<section> vs <article> is a distinction most developers get wrong at some point.
<article> is self-contained content that makes sense distributed independently: blog posts, news stories, forum threads, product cards.
<section> groups thematically related content within a page. It should have a heading. If you can't give it a heading, it probably wants to be a <div>.
<time> marks dates and times with a machine-readable datetime attribute:
<time datetime="2024-11-15">November 15, 2024</time>
<address> marks contact information related to the nearest <article> or <body> ancestor.
Global attributes apply to every HTML element. They are not tag-specific.
ARIA attribute usage has quadrupled since 2019, with pages now averaging 89 ARIA attributes each, according to WebAIM 2025. But pages with ARIA present show over twice as many accessibility errors as those without, averaging 57 errors vs. 27.
|
Attribute |
What it does |
|---|---|
|
|
Unique identifier for the element on the page |
|
|
One or more CSS class names for styling or JS targeting |
|
|
Inline CSS (use sparingly) |
|
|
Tooltip text on hover |
|
|
Language of the element's content |
|
|
Text direction: |
|
|
Hides the element from display and accessibility tree |
|
|
Controls keyboard navigation order |
|
|
Makes element content directly editable by the user |
data-* attributes store custom data on elements for JavaScript to read. The Web Almanac 2024 found data-id is used on 24% of mobile pages, making it the most popular custom data attribute.
<div data-product-id="4821" data-category="tools">...</div>
ARIA attributes communicate accessibility information to screen readers:
aria-label - provides a text label when visible text is absent
aria-hidden="true" - removes an element from the accessibility tree
role - assigns an explicit semantic role (use native HTML elements first)
The rule on ARIA: native HTML semantics always take priority. role="button" on a <div> is a workaround for not using <button>. Start with the right element and ARIA becomes rarely needed.
Some characters have special meaning in HTML markup and need to be escaped: <, >, &, and ". Use named or numeric character entities instead.
You must escape these when they appear as literal content:
< renders <
> renders >
& renders &
" renders "
' renders '
renders a non-breaking space (no line wrap at that point)
|
Entity name |
Numeric |
Renders |
|---|---|---|
|
|
|
© |
|
|
|
® |
|
|
|
™ |
|
|
|
€ |
|
|
|
£ |
|
|
|
- |
|
|
|
– |
|
|
|
… |
Named entities like © are easier to read in source. Numeric references like © work in any environment.
UTF-8 charset removes most problems. With <meta charset="UTF-8"> in <head>, you can paste most special characters directly into HTML without entities. The exceptions are still the 4 reserved characters above.
Meta tags in <head> control how search engines index your page and how it appears when shared on social platforms.
According to the Web Almanac 2024, og:title appears on 61% of mobile pages, og:url on 58%, and og:description on 53%. Title tags appear on 99.1% of pages.
<title> - the primary ranking and click signal in search results. Keep it under 60 characters.
<meta name="description"> - shown as the snippet in search results. Removing it can hurt click-through rates. One experiment removed title tags and meta descriptions from a $200,000/year site; traffic dropped 25% within two weeks (Ahrefs case study).
<meta name="robots"> - controls crawler behavior. Common values:
index, follow - default behavior (no need to add explicitly)
noindex - blocks the page from appearing in search results
- tells crawlers not to follow links on the page
<link rel="canonical"> - specifies the preferred URL when duplicate or near-duplicate versions exist. Canonical adoption reached 67% of pages in 2025 (Web Almanac 2025), up from 65% in 2024.
Open Graph controls link previews on Facebook, LinkedIn, and Slack. Twitter Cards handle the same for X (formerly Twitter).
Minimum Open Graph tags needed for a working preview:
<meta property="og:title" content="Page Title Here">
<meta property="og:description" content="Brief description under 160 characters">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:url" content="https://example.com/page">
Twitter Card minimum:
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Page Title Here">
<meta name="twitter:image" content="https://example.com/image.jpg">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> - required for responsive mobile rendering. Viewport meta tags now appear on over 93% of pages (Web Almanac 2025).
Deprecated tags were removed from HTML5 because CSS handles their function better. They still render in modern browsers for backward compatibility, but they carry no semantic meaning and fail accessibility checks.
12% of mobile pages still use document.write, a legacy JavaScript pattern closely tied to deprecated HTML practices, according to Web Almanac 2024.
These replaced by CSS properties completely:
|
Deprecated tag |
Use this instead |
|---|---|
|
|
CSS |
|
|
CSS |
|
|
CSS |
|
|
CSS |
|
|
CSS |
|
|
CSS |
|
|
|
<frame>, <frameset>, <noframes> - frame-based page layouts from the 1990s. Fully removed in HTML5. Replace with CSS layout or <iframe> where embedding is needed.
<acronym> - use <abbr> with a title attribute instead:
<abbr title="HyperText Markup Language">HTML</abbr>
<applet> - loaded Java applets. Replace with <object> or modern JavaScript equivalents.
Spotting deprecated tags in a codebase is a reliable signal of how long the project has gone without a markup audit. Running pages through the W3C Validator at validator.w3.org takes under a minute and flags every deprecated element in the source.
If you're working on front-end development in an older project, a quick pass through the HTML to replace deprecated tags with semantic equivalents is one of the fastest ways to improve both accessibility scores and code maintainability. The css cheat sheet covers the CSS replacement properties for every deprecated presentational tag above.
An HTML cheat sheet is a quick reference for HTML tags, attributes, and syntax. Developers use it to look up correct markup without opening full documentation. It covers everything from document structure to form elements, semantic tags, and character entities.
The tags you'll use in every project: <html>, <head>, <body>, <div>, <p>, <a>, <img>, <h1>–<h6>, <ul>, <li>, and <form>. Semantic elements like <main>, <nav>, and <footer> are equally important for accessibility.
An element is the tag itself, like <input>. An attribute modifies that element's behavior or appearance, like type="email" or required. Attributes always sit inside the opening tag and come in name-value pairs.
Tags like <font>, <center>, <strike>, <tt>, and <big> were removed in HTML5. CSS handles their styling functions now. <frame> and <frameset> were also dropped entirely. Use semantic HTML and CSS instead of these legacy elements.
Start with <!DOCTYPE html>, followed by <html lang="en">, then <head> (for meta tags, title, and stylesheet links), then <body> for all visible content. The charset and viewport meta tags belong at the top of <head>.
<div> and semantic HTML tags?<div> carries no meaning. It is a generic container. Semantic tags like <article>, <section>, and <aside> tell browsers and screen readers what the content represents. Use semantic tags first, and reach for <div> only when no semantic option fits.
A <form> element wraps input controls and sends collected data to a server via the action and method attributes. Input types like email, number, and date provide built-in browser validation. Every input needs a <label> linked by matching id and for values.
Character entities encode reserved characters that HTML would otherwise interpret as markup. < renders <, & renders &, and inserts a non-breaking space. With UTF-8 charset declared, most special symbols can be typed directly into HTML source.
The <title> tag and <meta name="description"> directly affect search result appearance and click-through rates. Open Graph tags (og:title, og:image, og:url) control social media previews. The <link rel="canonical"> tag prevents duplicate content issues across multiple URLs.
Full documentation like MDN Web Docs covers every attribute, browser compatibility table, and edge case. A cheat sheet gives you syntax at a glance: the tag, its key attributes, and a usage example. It is faster for daily lookup, not for learning a new concept from scratch.