Essential HTML5 Elements
Semantic elements give your document meaning beyond visual presentation. Screen readers, search engines, and browser features all rely on correct element choice.
| Element | Purpose | Example |
|---|---|---|
<header> |
Introductory content or navigational links for its nearest sectioning ancestor | <header><h1>Site Title</h1><nav>...</nav></header> |
<nav> |
Section containing navigation links (main nav, breadcrumbs, TOC) | <nav aria-label="Main"><a href="/">Home</a></nav> |
<main> |
Dominant content of the document body, unique per page | <main id="content">...</main> |
<article> |
Self-contained composition — blog post, news story, widget | <article><h2>Post Title</h2><p>...</p></article> |
<section> |
Thematic grouping of content, typically with a heading | <section id="faq"><h2>FAQ</h2>...</section> |
<aside> |
Content tangentially related to surrounding content (sidebars, pull quotes) | <aside><h3>Related Articles</h3>...</aside> |
<footer> |
Footer for its nearest sectioning ancestor (copyright, links, contact) | <footer><p>© 2026</p></footer> |
<figure> / <figcaption> |
Self-contained content (image, diagram, code listing) with optional caption | <figure><img src="chart.png" alt="..."><figcaption>Fig 1</figcaption></figure> |
<details> / <summary> |
Disclosure widget — content hidden until user expands it | <details><summary>More info</summary><p>...</p></details> |
<dialog> |
Modal or non-modal dialog box with built-in open/close API | <dialog id="d"><p>Confirm?</p></dialog> |
<template> |
Inert HTML fragment — not rendered until cloned via JavaScript | <template id="row"><tr><td></td></tr></template> |
<search> |
Container for search or filtering controls New | <search><form role="search">...</form></search> |
<time> |
Machine-readable date/time with human-readable text content | <time datetime="2026-02-19">Feb 19, 2026</time> |
<mark> |
Highlighted text — search results, key phrases | <p>Found: <mark>CSS Grid</mark> in 3 results</p> |
<picture> / <source> |
Art-direction responsive images with media-query-based source selection | <picture><source srcset="wide.webp" media="(min-width:800px)"><img src="narrow.jpg" alt="..."></picture> |
CSS Selector Quick Reference
Modern CSS selectors dramatically reduce the need for utility classes and JavaScript. These selectors have shipped in all major browsers.
| Selector | Syntax | What It Selects |
|---|---|---|
:is() |
:is(h1, h2, h3) |
Matches any element in the list. Takes the highest specificity of its arguments. |
:where() |
:where(.card, .panel) .title |
Same matching as :is() but with zero specificity. Ideal for defaults. |
:has() |
.card:has(img) |
Parent/relational selector — matches elements that contain a matching descendant. |
:not() |
:not(.hidden, .collapsed) |
Matches elements that do NOT match any of the selectors in the list. |
:nth-child(of) |
:nth-child(odd of .visible) |
Filtered nth-child — only counts elements matching the of selector. |
::backdrop |
dialog::backdrop |
The overlay behind a top-layer element (dialog, fullscreen). |
::marker |
li::marker |
The bullet or number of a list item — color, font, content customizable. |
::placeholder |
input::placeholder |
The placeholder text inside form inputs. |
[attr^=val] |
[href^="https://"] |
Attribute starts-with selector. Also: $= (ends), *= (contains). |
Modern CSS Properties
Properties and at-rules that have reached Baseline availability across all major browsers. These are production-ready today.