Web Development Cheat Sheets: HTML, CSS, JS & More
Concise web development cheat sheets for HTML, CSS, JavaScript, PHP and WordPress, Elementor and WooCommerce, SEO, website speed and Core Web Vitals, DNS and SSL, Git and accessibility. Each is a compact on-page reference linking to deeper guides where available. Always confirm details against current official documentation.
- 11 min read
- Updated November 17, 2026
These cheat sheets are quick, accurate references for everyday web work: HTML elements and attributes, CSS selectors, Flexbox and Grid, JavaScript syntax, PHP and WordPress functions, SEO tags, Core Web Vitals thresholds, DNS records and common Git commands. Bookmark the page and use your browser’s search (Ctrl+F or Cmd+F) to jump to what you need.
- Cheat Sheet Categories
- Featured Cheat Sheets
- HTML Cheat Sheet
- CSS Cheat Sheet
- JavaScript Cheat Sheet
- PHP and WordPress Cheat Sheets
- Elementor and WooCommerce References
- SEO Cheat Sheet
- Website Speed and Core Web Vitals
- Hosting, DNS and SSL References
- Git and Command-Line Cheat Sheet
- Accessibility and Responsive Design References
- Quick Lookup Tables
- How to Use Cheat Sheets Effectively
- On-Page vs Downloadable References
- Common Cheat Sheet Mistakes
Cheat Sheet Categories
HTML Cheat Sheets
Tags, forms, semantics
CSS Cheat Sheets
Selectors, box model, layout
JavaScript Cheat Sheets
Syntax, arrays, async, DOM
PHP Cheat Sheets
Arrays, functions, types
WordPress Cheat Sheets
Hooks, WP_Query, enqueueing
Elementor Cheat Sheets
Containers, Theme Builder
SEO Cheat Sheets
On-page, technical, measurement
Technical SEO Cheat Sheets
Crawl, index, status codes
Website Speed Cheat Sheets
Images, caching, JS
Core Web Vitals Cheat Sheets
LCP, INP, CLS thresholds
Hosting & DNS Cheat Sheets
Records, SSL, propagation
Forms & Accessibility Cheat Sheets
Labels, focus, contrast
Git & Command Line Cheat Sheets
Everyday commands
Website Design Cheat Sheets
Responsive and accessible basics
WooCommerce Cheat Sheets
Products, variations, checkout
Web Development Tools Cheat Sheets
Quick lookup tables
Featured Cheat Sheets
On-page reference
HTML Tags Cheat Sheet
For: Beginners. Topics: Structure, semantics, forms. View on this page On-page reference
CSS Properties Cheat Sheet
For: Designers, developers. Topics: Box model, typography. View on this page On-page reference
CSS Flexbox Cheat Sheet
For: Front-end devs. Topics: Axes, alignment, wrapping. View on this page On-page reference
CSS Grid Cheat Sheet
For: Front-end devs. Topics: Tracks, areas, minmax. View on this page On-page reference
JavaScript Syntax Cheat Sheet
For: Developers. Topics: Functions, arrays, async. View on this page On-page reference
WordPress Functions Cheat Sheet
For: WP developers. Topics: Hooks, queries, enqueue. View on this page On-page reference
SEO Checklist Cheat Sheet
For: SEOs, writers. Topics: Titles, headings, indexing. View on this page On-page reference
Website Speed Reference
For: Developers. Topics: Images, caching, JS. View on this page On-page reference
Core Web Vitals Cheat Sheet
For: Everyone. Topics: LCP, INP, CLS. View on this page On-page reference
DNS Records Cheat Sheet
For: Site owners. Topics: A, CNAME, MX, TXT. View on this page On-page reference
Git Commands Cheat Sheet
For: Developers. Topics: Status, commit, branch. View on this page On-page reference
HTML Accessibility Cheat Sheet
For: Everyone. Topics: Labels, alt text, focus. View on this page
HTML Cheat Sheet
Semantic elements (header, nav, main, article, section, aside, footer) describe meaning; div and span are generic containers with no meaning. Avoid obsolete elements such as <font> or <center>. See our HTML guide.
Document structure
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Page title</title> <meta name="description" content="Short summary"> <link rel="stylesheet" href="styles.css"> </head> <body> <header>…</header> <main>…</main> <footer>…</footer> <script src="app.js" defer></script> </body> </html>
Text, links, images and lists
<h1>Main heading</h1>
<p>Paragraph with <a href="/about/">a descriptive link</a>.</p>
<img src="team.webp" alt="Our team at the office"
width="800" height="533">
<img src="divider.svg" alt=""> <!-- decorative -->
<ul>
<li>Unordered item</li>
</ul>
<ol>
<li>Ordered step</li>
</ol> Use empty alt only for decorative images.
Forms
<form action="/contact" method="post">
<label for="email">Email</label>
<input id="email" name="email" type="email"
autocomplete="email" required>
<label for="msg">Message</label>
<textarea id="msg" name="message"></textarea>
<button type="submit">Send</button>
</form> Common input types: text, email, tel, url, number, date, checkbox, radio, password, search.
Tables and entities
<table>
<caption>Plan comparison</caption>
<thead>
<tr><th scope="col">Plan</th><th scope="col">Price</th></tr>
</thead>
<tbody>
<tr><td>Basic</td><td>…</td></tr>
</tbody>
</table>
& < > " © Use tables for tabular data, not layout.
CSS Cheat Sheet
Which declaration wins depends on cascade layers, specificity, source order and inheritance. Fix conflicts by understanding these, not by defaulting to !important. See our CSS guide.
Selectors and specificity
p { } /* type: 0-0-1 */
.card { } /* class: 0-1-0 */
#main { } /* id: 1-0-0 */
.nav a:hover { } /* 0-2-1 */
ul > li { } /* child */
h2 + p { } /* adjacent sibling */
a[href^="https"] { }/* attribute */
.btn::before { } /* pseudo-element */ Box model, colour and type
*, *::before, *::after { box-sizing: border-box; }
.box {
margin: 1rem auto;
padding: 1rem 1.5rem;
border: 1px solid #dce8f5;
border-radius: 12px;
box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
color: #0f172a;
font: 400 1rem/1.6 Inter, sans-serif;
} Flexbox
.row {
display: flex;
flex-direction: row; /* main axis */
flex-wrap: wrap;
justify-content: space-between; /* main axis */
align-items: center; /* cross axis */
gap: 1rem;
}
.row > .item { flex: 1 1 200px; } /* grow shrink basis */ Grid
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: 1rem;
}
.layout {
display: grid;
grid-template-areas: "header header" "nav main";
grid-template-columns: 200px 1fr;
}
.layout header { grid-area: header; } Positioning and display
.badge { position: absolute; top: 0; right: 0; }
.parent { position: relative; }
.sticky { position: sticky; top: 0; }
.hidden { display: none; }
.inline { display: inline-block; } Responsive, custom properties, motion
@media (min-width: 768px) {
.grid { grid-template-columns: 1fr 1fr; }
}
:root { --brand: #1562b1; }
.btn { background: var(--brand); transition: background 0.2s ease; }
.btn:hover, .btn:focus-visible { background: #0d4a8a; }
@media (prefers-reduced-motion: reduce) {
.btn { transition: none; }
} JavaScript Cheat Sheet
Core language syntax works everywhere; document and window are browser APIs, while modules such as fs are Node.js APIs. See our JavaScript guide.
Variables, types and operators
const name = "Ana"; // cannot be reassigned let count = 0; // can be reassigned // string, number, bigint, boolean, undefined, null, symbol, object count += 1; const isAdult = age >= 18 && hasId; const label = value ?? "default"; // nullish coalescing const city = user?.address?.city; // optional chaining
Conditionals, loops, functions
if (score > 90) {
grade = "A";
} else {
grade = "B";
}
for (const item of items) { console.log(item); }
function add(a, b) { return a + b; }
const double = (n) => n * 2;
const greet = `Hello, ${name}!`; // template literal Arrays, objects, destructuring
const nums = [1, 2, 3, 4];
nums.map((n) => n * 2); // [2, 4, 6, 8]
nums.filter((n) => n % 2 === 0); // [2, 4]
nums.reduce((sum, n) => sum + n, 0); // 10
nums.find((n) => n > 2); // 3
const user = { id: 1, name: "Ana" };
const { name: userName } = user;
const copy = { ...user, active: true }; Async, errors and JSON
async function loadPosts() {
try {
const res = await fetch("/wp-json/wp/v2/posts");
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const posts = await res.json();
return posts;
} catch (err) {
console.error(err);
return [];
}
}
JSON.stringify({ a: 1 }); // '{"a":1}'
JSON.parse('{"a":1}'); // { a: 1 } DOM and events (browser)
const btn = document.querySelector(".menu-toggle");
const items = document.querySelectorAll(".item");
btn.addEventListener("click", () => {
const open = btn.getAttribute("aria-expanded") === "true";
btn.setAttribute("aria-expanded", String(!open));
});
el.textContent = userInput; // safer than innerHTML for text Modules
// math.js
export function sum(a, b) { return a + b; }
export default function multiply(a, b) { return a * b; }
// app.js
import multiply, { sum } from "./math.js";
<!-- in HTML -->
<script type="module" src="app.js"></script> PHP and WordPress Cheat Sheets
Test code in the relevant PHP and WordPress versions, on staging, with backups. Never edit WordPress core files; use a child theme or plugin. Escape output, sanitise input and check capabilities. See our WordPress guide and PHP guide.
PHP basics
<?php
declare(strict_types=1);
$name = "Ana";
$items = ["a", "b"];
$user = ["id" => 1, "role" => "editor"];
function greet(string $name): string {
return "Hello, " . $name;
}
foreach ($items as $i => $item) {
echo $i . ": " . $item . PHP_EOL;
}
if (isset($user["role"]) && $user["role"] === "editor") { /* ... */ }
try {
risky();
} catch (Exception $e) {
error_log($e->getMessage());
} Actions and filters
// Action: run code at a point
add_action( 'init', 'myprefix_register_types' );
// Filter: modify and return a value
add_filter( 'excerpt_length', function ( $length ) {
return 30;
} ); Actions run code; filters receive a value and must return it.
Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style(
'mytheme-style',
get_stylesheet_uri(),
array(),
'1.0'
);
wp_enqueue_script(
'mytheme-app',
get_stylesheet_directory_uri() . '/js/app.js',
array(),
'1.0',
array( 'strategy' => 'defer' )
);
} ); The strategy argument requires WordPress 6.3 or later.
WP_Query and template tags
$q = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 5,
) );
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
printf(
'<a href="%s">%s</a>',
esc_url( get_permalink() ),
esc_html( get_the_title() )
);
}
wp_reset_postdata();
} Shortcode with escaping
add_shortcode( 'greeting', function ( $atts ) {
$atts = shortcode_atts(
array( 'name' => 'friend' ),
$atts
);
return '<p>Hello, ' . esc_html( $atts['name'] ) . '</p>';
} );
// Usage: [greeting name="Ana"] Child theme, plugin header, REST
/* style.css (child theme) */
/*
Theme Name: My Child Theme
Template: parent-theme-folder
*/
<?php
/*
* Plugin Name: My Plugin
* Version: 1.0.0
*/
// REST API: list posts
// GET /wp-json/wp/v2/posts
// Capability check
if ( current_user_can( 'manage_options' ) ) { /* ... */ } Template hierarchy: WordPress picks the most specific template file, e.g. single-{post-type}.php, then single.php, then singular.php, then index.php.
Elementor and WooCommerce References
| Elementor | Quick reference |
|---|---|
| Containers | Flexbox (and grid) layout blocks; nest for columns |
| Responsive controls | Per-breakpoint values for many settings |
| Global colors and fonts | Site Settings for consistent styles |
| Theme Builder | Headers, footers, single and archive templates (Elementor Pro) |
| Template import | Templates panel → Import; check required widgets |
| Free vs Pro | Some widgets and features need Pro |
| Third-party add-ons | Separate plugins, not part of Elementor |
| WooCommerce | Quick reference |
|---|---|
| Product types | Simple, variable, grouped, external/affiliate |
| Attributes and variations | Attributes (e.g. size) create variations of a variable product |
| Cart and checkout | Dedicated pages; block-based versions available |
| Hooks | WooCommerce provides its own actions and filters; check developer docs before use |
| Extensions | Payments, shipping, subscriptions from WooCommerce Marketplace |
| Conflicts | Test on staging: default theme, plugins one at a time |
Elementor features are separate from WordPress core and third-party add-ons. We do not list undocumented selectors or hooks; consult official documentation.
SEO Cheat Sheet
| On-page | Reminder |
|---|---|
| Page title | Unique, descriptive <title> |
| Meta description | Accurate summary; Google may rewrite |
| Headings | One H1, logical H2/H3 |
| Internal links | Descriptive anchor text |
| Image alt | Describe meaningful images |
| Search intent | Match what searchers need |
| Usefulness | Original, accurate, helpful content |
| Canonical | <link rel=”canonical”> to preferred URL |
| Technical | Reminder |
|---|---|
| Crawlability | Links reachable; not blocked in robots.txt |
| Indexability | No unintended noindex |
| XML sitemap | Canonical, indexable URLs |
| Robots directives | robots.txt vs meta robots |
| Redirects | 301 permanent, 302 temporary |
| Status codes | 200 OK, 301, 404, 410, 500 |
| Structured data | JSON-LD, validate with Rich Results Test |
| Mobile | Responsive, readable on phones |
Measurement: Search Console (impressions, clicks), analytics and conversions, plus regular audits. Metadata and checklists do not guarantee rankings, and search engines may choose their own title links and snippets. See website SEO.
Website Speed and Core Web Vitals
| Metric | What it measures | “Good” threshold |
|---|---|---|
| LCP | Largest Contentful Paint: loading | ≤ 2.5 s |
| INP | Interaction to Next Paint: responsiveness | ≤ 200 ms |
| CLS | Cumulative Layout Shift: visual stability | ≤ 0.1 |
Thresholds per Google’s web.dev guidance, assessed at the 75th percentile of page loads. FID is no longer a Core Web Vital. TTFB is a diagnostic metric, not a Core Web Vital.
| Topic | Reminder |
|---|---|
| Lab vs field | Lighthouse simulates; CrUX/RUM measures real users |
| Tools | PageSpeed Insights, Lighthouse, DevTools |
| Images | Right size, modern formats, dimensions set |
| Caching and CDN | Reduce repeat work and distance |
| Fonts | Few weights, font-display, preload only critical |
| JavaScript | Defer non-critical, cut long tasks |
| Render-blocking | Inline critical CSS, defer the rest |
See Core Web Vitals and page speed.
Hosting, DNS and SSL References
| Record | Purpose | Common use |
|---|---|---|
| A | Name → IPv4 address | Point domain to server |
| AAAA | Name → IPv6 address | IPv6 hosting |
| CNAME | Alias to another hostname | www → host target (not at apex in standard DNS) |
| MX | Mail servers for the domain | Email hosting |
| TXT | Text data | SPF, DKIM, DMARC, verification |
| NS | Authoritative name servers | Delegating DNS |
| CAA | Which CAs may issue certificates | Certificate control |
Propagation time varies with TTL and resolver caching; it is not a fixed duration. Domain registration and hosting are separate services. HTTPS uses TLS certificates to encrypt traffic. Verify intended values before changing production DNS, because mistakes can take sites or email offline. See Cloudflare and CDN.
Git and Command-Line Cheat Sheet
git init # start a repository git status # see changed files git add file.txt # stage a file git commit -m "Message" # record staged changes git log --oneline # compact history git branch feature-x # create a branch git switch feature-x # move to a branch git diff # unstaged changes git merge feature-x # merge into current branch git pull # fetch and integrate remote git push origin main # upload commits
Caution: commands such as git reset --hard, git clean -fd or git push --force discard work or rewrite shared history; understand them before use. Shell syntax differs between Bash/zsh and Windows PowerShell or Command Prompt.
Accessibility and Responsive Design References
- Use semantic HTML before ARIA
- Every interactive element reachable by keyboard
- Visible focus indicators (:focus-visible)
- Labels for every form field
- Alt text for informative images
- Text contrast that meets WCAG guidance
- Clear accessible names for buttons and links
- Logical heading hierarchy
- Breakpoints where content needs them
- Flexible layouts with flex, grid and relative units
- Touch targets large enough to tap
- Respect prefers-reduced-motion
- Test zoom and text resizing
A short reference cannot establish full accessibility compliance, and automated tools cannot detect every issue. See website accessibility and responsive design.
Quick Lookup Tables
Table A: HTML elements
| Element | Purpose | Common use |
|---|---|---|
| <main> | Primary content | Once per page |
| <nav> | Navigation links | Menus |
| <article> | Self-contained content | Posts, cards |
| <section> | Thematic group | Page sections with headings |
| <button> | Action control | Forms, toggles |
Table B: CSS layout
| Technique | Purpose | Application |
|---|---|---|
| display: flex | 1D layout | Rows of items |
| display: grid | 2D layout | Page and card grids |
| position: sticky | Stick on scroll | Headers |
| clamp() | Fluid values | Responsive type |
| aspect-ratio | Reserve space | Media |
Table C: JavaScript methods
| Method | Purpose | Consideration |
|---|---|---|
| map() | Transform each item | Returns new array |
| filter() | Keep matching items | Returns new array |
| reduce() | Combine to one value | Provide initial value |
| querySelector() | Find element | Returns null if none |
| addEventListener() | Handle events | Remove when no longer needed |
Table D: SEO terminology
| Term | Meaning | Useful for |
|---|---|---|
| Canonical | Preferred URL version | Duplicates |
| Noindex | Exclude from index | Thin or private pages |
| Crawl budget | Crawl capacity and demand | Large sites |
| SERP | Results page | Snippet review |
| Structured data | Machine-readable info | Rich result eligibility |
Table E: Website performance
| Metric | Measures | Investigate with |
|---|---|---|
| LCP | Main content load | PSI, DevTools Performance |
| INP | Interaction delay | Field data, DevTools |
| CLS | Layout shifts | DevTools Rendering |
| TTFB | Server response (diagnostic) | Network panel |
Table F: DNS records
| Record | Purpose | Use |
|---|---|---|
| A / AAAA | Address | Hosting |
| CNAME | Alias | Subdomains |
| MX | ||
| TXT | Text | Verification, SPF |
| CAA | CA authorisation | Certificates |
How to Use Cheat Sheets Effectively
- Identify the task or problem
- Open the relevant reference
- Check against current documentation
- Adapt to project requirements
- Test in a safe environment
- Review accessibility, security, compatibility
- Document project-specific changes
Seven-step workflow for using cheat sheets
Identify the task or problem
Open the relevant reference
Check against current documentation
Adapt to project requirements
Test in a safe environment
Review accessibility, security, compatibility
Document project-specific changes
Cheat sheets support learning and quick lookup but do not replace documentation, testing or code review.
On-Page vs Downloadable References
| Format | Status on this page |
|---|---|
| On-page reference | Available here now |
| Printable guide | Print this page from your browser |
| Not currently offered | |
| Image reference | Not currently offered |
| Snippet collection | Code blocks on this page |
| Downloadable file | Not currently offered |
| Interactive lookup tool | Not currently offered |
Common Cheat Sheet Mistakes
Outdated syntax
Check current docs.
Copying without understanding
Read each line.
Ignoring browser support
Check compatibility tables.
Untested snippets
Test on staging.
Core vs plugin confusion
Know where features come from.
Outdated SEO terms
FID is no longer a Core Web Vital.
!important everywhere
Fix specificity instead.
Running unknown commands
Understand effects first.
Copying DNS records from other setups
Use your provider’s values.
Ignoring accessibility and security
Review before shipping.
More in Resources
Checklists
Practical website checklists for design, launch, SEO, security and maintenance that you can follow one step at a time.
Web Design Resources
A curated list of free, high-quality web design resources: fonts, icons, stock photos, illustrations, colour tools, UI kits, inspiration and…
Web Design & Development Glossary
A web design glossary of plain-English definitions for the web design, development, hosting and SEO terms you will see in…
Web development cheat sheets: your questions answered
Short, honest answers to the questions people ask most about this topic.
Can I download these cheat sheets?
They are designed as an online reference you can bookmark and print from your browser. Downloadable versions may be added later.
Are the cheat sheets up to date?
Check them against official documentation such as MDN Web Docs, the WordPress developer handbook and Google Search Central.
Which cheat sheet should beginners start with?
Start with the HTML and CSS sheets, then JavaScript. They cover the building blocks used on every website.
Keep building your skills
Explore the rest of our Resources guides, or follow the beginner path step by step.