HTML and CSS glossary — 250 terms
HTML
A markup language that describes document meaning and structure.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
CSS
A style language that controls presentation through selectors, properties and the cascade.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Element
A document structure with a name, attributes and permitted content.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Tag
The source syntax marking an element’s start or end.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Attribute
A named value on an opening tag that supplies additional information.
Attributes add information to an opening tag, such as an identifier or language. Attribute values should be quoted consistently. id values identify a unique element and can be used by links and selectors. Comments explain intent to future authors but are not visible content. Nest children inside a permitted parent and close them in reverse order. The DOM tree is the final evidence of how the browser interpreted your nesting.
<!-- The introduction is a link target. --> <section id="intro"><h1>Introduction</h1><p>Start with <em>one</em> change.</p></section>
Why it matters: The section has a stable link target and contains the heading and paragraph as children.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Document
A complete browser page with metadata and content.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
DOM
The tree of objects produced when a browser parses source.
Source code is the text you author, while the DOM is the tree the browser constructs from it. Browsers repair some invalid markup, so the resulting tree can differ from the typed source. Elements can contain text and permitted child elements. strong communicates importance and em communicates emphasis; choosing them solely for bold or italic appearance loses the meaning. Inspect the document tree after a change rather than assuming indentation defines nesting.
<p>Read <strong>important instructions</strong> before you <em>publish</em>.</p>
Why it matters: The important phrase is a child of the paragraph and has explicit importance semantics.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Parent
An element that directly contains another node.
Attributes add information to an opening tag, such as an identifier or language. Attribute values should be quoted consistently. id values identify a unique element and can be used by links and selectors. Comments explain intent to future authors but are not visible content. Nest children inside a permitted parent and close them in reverse order. The DOM tree is the final evidence of how the browser interpreted your nesting.
<!-- The introduction is a link target. --> <section id="intro"><h1>Introduction</h1><p>Start with <em>one</em> change.</p></section>
Why it matters: The section has a stable link target and contains the heading and paragraph as children.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Child
A node directly contained by another node.
Source code is the text you author, while the DOM is the tree the browser constructs from it. Browsers repair some invalid markup, so the resulting tree can differ from the typed source. Elements can contain text and permitted child elements. strong communicates importance and em communicates emphasis; choosing them solely for bold or italic appearance loses the meaning. Inspect the document tree after a change rather than assuming indentation defines nesting.
<p>Read <strong>important instructions</strong> before you <em>publish</em>.</p>
Why it matters: The important phrase is a child of the paragraph and has explicit importance semantics.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Semantic HTML
Elements chosen for meaning rather than only default appearance.
Semantic elements describe purpose. main identifies the principal content; nav identifies navigation; article identifies a self-contained composition. A generic div remains appropriate when no more specific meaning applies. Do not select an element merely because its default display looks convenient. Review the landmark and heading outline together to understand the page.
<main><h1>Field Notes</h1><article><h2>Designing a small page</h2><p>Start with the content.</p></article></main>
Why it matters: A self-contained article is placed inside the principal content landmark.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Landmark
A page region that supports navigation by purpose.
Semantic elements describe purpose. main identifies the principal content; nav identifies navigation; article identifies a self-contained composition. A generic div remains appropriate when no more specific meaning applies. Do not select an element merely because its default display looks convenient. Review the landmark and heading outline together to understand the page.
<main><h1>Field Notes</h1><article><h2>Designing a small page</h2><p>Start with the content.</p></article></main>
Why it matters: A self-contained article is placed inside the principal content landmark.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Accessibility
Design that people with diverse abilities and technologies can use.
A complete HTML document includes a doctype, an html root with language, a head for metadata and a body for visible content. Developer tools expose the browser’s interpreted DOM and computed CSS, not just the original file. The academy inspector reports the actual sandbox DOM. Browser tools offer deeper debugging and accessibility inspection after export. A title belongs in head and appears in browser UI rather than as a visible body heading.
<!doctype html> <html lang="en"><head><meta charset="utf-8"><title>Alex’s journal</title></head><body><h1>Learning journal</h1><p>Inspect this page.</p></body></html>
Why it matters: The root declares English so assistive technologies have a language cue; the document title identifies the tab.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Viewport
The CSS layout area available to a document.
A useful page title describes the specific page. The meta description summarizes its content but is not a guaranteed search-result snippet. The viewport meta element asks mobile browsers to use the device width in CSS pixels; it does not make a fixed-width layout responsive by itself. Keep metadata accurate instead of stuffing keywords. The academy’s exported document includes a complete shell, and authored full documents retain their own metadata.
<!doctype html><html lang="en"><head><title>Workshop registration — Field Notes</title><meta name="description" content="Register for a practical web design workshop."><meta name="viewport" content="width=device-width, initial-scale=1"></head><body><h1>Workshop registration</h1></body></html>
Why it matters: The page has a specific title and a concise description associated with the actual registration content.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Stylesheet
A collection of CSS rules attached to a document.
A stylesheet contains rules. A selector identifies elements, and declarations assign property/value pairs. CSS is interpreted independently of HTML structure, so a rule matching no elements has no visible effect. Start with one property and compare before combining many changes. The browser’s computed style reveals which value actually won, while the rule list shows candidate declarations.
<h1>A styled heading</h1><p>The content stays meaningful.</p>
h1 { color: #234f9b; }Why it matters: Only the matched heading receives the blue text color; the paragraph keeps its inherited/default styling.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Selector
A pattern identifying elements to which a rule applies.
HTML supplies structure, CSS controls presentation and JavaScript can change behavior. They are separate layers: a heading remains a heading when its color changes. A CSS rule has a selector followed by a declaration block; color is a property and royalblue is its value. This example uses no JavaScript because styling alone needs none. The optional script editor is reserved for later interaction work. Predict which elements each selector matches before rendering.
<h1>Structure and style</h1>
<p>CSS changes presentation.</p>
h1 { color: royalblue; }
p { font-size: 18px; }Why it matters: The paragraph becomes 18 CSS pixels while the heading receives its own color rule.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Declaration
A property/value pair inside a CSS block.
HTML supplies structure, CSS controls presentation and JavaScript can change behavior. They are separate layers: a heading remains a heading when its color changes. A CSS rule has a selector followed by a declaration block; color is a property and royalblue is its value. This example uses no JavaScript because styling alone needs none. The optional script editor is reserved for later interaction work. Predict which elements each selector matches before rendering.
<h1>Structure and style</h1>
<p>CSS changes presentation.</p>
h1 { color: royalblue; }
p { font-size: 18px; }Why it matters: The paragraph becomes 18 CSS pixels while the heading receives its own color rule.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Property
A named CSS presentation feature such as padding.
HTML supplies structure, CSS controls presentation and JavaScript can change behavior. They are separate layers: a heading remains a heading when its color changes. A CSS rule has a selector followed by a declaration block; color is a property and royalblue is its value. This example uses no JavaScript because styling alone needs none. The optional script editor is reserved for later interaction work. Predict which elements each selector matches before rendering.
<h1>Structure and style</h1>
<p>CSS changes presentation.</p>
h1 { color: royalblue; }
p { font-size: 18px; }Why it matters: The paragraph becomes 18 CSS pixels while the heading receives its own color rule.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Value
The specific setting assigned to a CSS property.
HTML supplies structure, CSS controls presentation and JavaScript can change behavior. They are separate layers: a heading remains a heading when its color changes. A CSS rule has a selector followed by a declaration block; color is a property and royalblue is its value. This example uses no JavaScript because styling alone needs none. The optional script editor is reserved for later interaction work. Predict which elements each selector matches before rendering.
<h1>Structure and style</h1>
<p>CSS changes presentation.</p>
h1 { color: royalblue; }
p { font-size: 18px; }Why it matters: The paragraph becomes 18 CSS pixels while the heading receives its own color rule.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Cascade
The ordered process that selects applicable winning declarations.
An inline style is attached to one element, an internal style element contains rules in a document, and an external stylesheet is linked by a path. External files are easier to share across pages. The academy’s CSS editor represents styles.css and the export links it automatically for fragments. A full authored document can include its own style or project stylesheet links. Cascade order still matters when several sources apply.
<h1 style="text-decoration: underline;">Three places for CSS</h1><p class="note">The external stylesheet controls this paragraph.</p>
.note { font-weight: 700; }Why it matters: The paragraph uses a reusable class rule, while the heading demonstrates a separate inline declaration.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Specificity
A lexicographic selector weight used after earlier cascade priorities tie.
A type selector matches element names, a class selector matches reusable class tokens, and an ID selector matches a unique identifier. Classes usually make reusable component styling easier than IDs. Specificity is only one stage in the cascade; importance, layers and origin can take precedence. Inspect actual matches before diagnosing a conflict.
<h1 id="page-title">Selector practice</h1><p class="highlight">A reusable highlight.</p><p>Unselected text.</p>
.highlight { background-color: #fff0b3; }Why it matters: Only the paragraph with the matching class receives the background; the other paragraph remains unchanged.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Inheritance
The propagation of selected computed values from parent to child.
Some properties such as color inherit by default; many box-model properties do not. A declaration on the child can override an inherited value. inherit explicitly takes the parent’s computed value, while initial uses the property’s initial value rather than a user-agent styling convention. Inspect parent and child independently before blaming a selector that does not match.
<section class="parent"><p>Inherited text color</p><p class="own">An explicit child color</p></section>
.parent { color: #234f9b; } .own { color: #713b12; }Why it matters: The child with its own declaration uses brown while the other paragraph inherits the parent’s blue.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Box model
The relationship of content, padding, border and margin.
The box model separates content from internal padding, border and external margin. A background extends through padding by default but margin stays outside it. With content-box sizing, a declared width excludes padding and border. The box-model inspector reports actual browser dimensions and computed edges; its diagram is a labeled educational view. Change one edge at a time and compare the outer width.
<div class="box">A box with content</div>
.box { width: 200px; padding: 20px; border: 2px solid #234f9b; margin: 16px; }Why it matters: Twenty pixels of internal space separate content from its border; margin creates external separation.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Content box
The area containing the element’s actual content.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Padding
Internal space between content and border.
The box model separates content from internal padding, border and external margin. A background extends through padding by default but margin stays outside it. With content-box sizing, a declared width excludes padding and border. The box-model inspector reports actual browser dimensions and computed edges; its diagram is a labeled educational view. Change one edge at a time and compare the outer width.
<div class="box">A box with content</div>
.box { width: 200px; padding: 20px; border: 2px solid #234f9b; margin: 16px; }Why it matters: Twenty pixels of internal space separate content from its border; margin creates external separation.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Margin
External separation outside the border; some block margins collapse.
The box model separates content from internal padding, border and external margin. A background extends through padding by default but margin stays outside it. With content-box sizing, a declared width excludes padding and border. The box-model inspector reports actual browser dimensions and computed edges; its diagram is a labeled educational view. Change one edge at a time and compare the outer width.
<div class="box">A box with content</div>
.box { width: 200px; padding: 20px; border: 2px solid #234f9b; margin: 16px; }Why it matters: Twenty pixels of internal space separate content from its border; margin creates external separation.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Border
The edge between padding and external margin.
A caption names the table. scope clarifies whether a header applies to its row or column in simple tables. Complex multi-level tables may need explicit header associations and often benefit from redesign. Visual bold text alone does not make a data cell a header. Review relationships without relying on color or borders.
<table><caption>Available seats</caption><tr><th scope="col">Day</th><th scope="col">Seats</th></tr><tr><th scope="row">Monday</th><td>12</td></tr></table>
table { border-collapse: collapse; } th,td { padding:.6rem; border-bottom:1px solid #aaa; }Why it matters: Monday is a row header and the table caption supplies context for the seat count.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Flexbox
A layout model primarily coordinating items along one axis.
A flex container lays out its direct children as flex items. flex-direction determines the main axis; the cross axis is perpendicular. justify-content works along the main axis and align-items along the cross axis, so their visual directions change when flex-direction changes. Flexbox is useful for distributing a one-dimensional group whose sizes may vary.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display: flex; flex-direction: row; gap: 1rem; } article { padding: 1rem; background:#e8eef7; }Why it matters: The articles become direct flex items in a row and participate in flex sizing.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Main axis
The axis established by flex-direction.
A flex container lays out its direct children as flex items. flex-direction determines the main axis; the cross axis is perpendicular. justify-content works along the main axis and align-items along the cross axis, so their visual directions change when flex-direction changes. Flexbox is useful for distributing a one-dimensional group whose sizes may vary.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display: flex; flex-direction: row; gap: 1rem; } article { padding: 1rem; background:#e8eef7; }Why it matters: The articles become direct flex items in a row and participate in flex sizing.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Cross axis
The axis perpendicular to a flex container’s main axis.
A flex container lays out its direct children as flex items. flex-direction determines the main axis; the cross axis is perpendicular. justify-content works along the main axis and align-items along the cross axis, so their visual directions change when flex-direction changes. Flexbox is useful for distributing a one-dimensional group whose sizes may vary.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display: flex; flex-direction: row; gap: 1rem; } article { padding: 1rem; background:#e8eef7; }Why it matters: The articles become direct flex items in a row and participate in flex sizing.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Grid
A layout model coordinating rows and columns of tracks.
Choose structures according to relationships. A description list pairs terms with definitions; a table relates two dimensions; a list groups peers. Using extra div elements for every pair makes those relationships harder to recover. Native elements usually need less custom accessibility work than invented roles. CSS can present a description list as a neat grid without changing its meaning.
<h1>Course facts</h1><dl><dt>Duration</dt><dd>Two afternoons</dd><dt>Prerequisite</dt><dd>A browser and curiosity</dd></dl>
dl { display: grid; grid-template-columns: 8rem 1fr; gap:.5rem; } dd { margin:0; }Why it matters: Each term is paired with a description, while Grid handles the presentation.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Grid track
The space between two adjacent grid lines.
Grid tracks are the spaces between numbered lines. Columns and rows have independent definitions; gap separates tracks and is not an outer margin. Explicit track sizes can differ from the resulting used sizes when constraints or content intervene. Use the actual grid measurements and inspect long words rather than assuming a tidy short demo represents all inputs.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display:grid; grid-template-columns: 2fr 1fr; grid-auto-rows:minmax(5rem, auto); gap:24px; } article { background:#e8eef7; padding:1rem; }Why it matters: A 24px gap separates the tracks; the first column receives twice the flexible fraction of the second.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Grid area
A rectangular collection of grid cells.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Fractional unit
A share of remaining flexible grid space expressed with fr.
fr distributes remaining space among flexible tracks. repeat avoids duplicating track lists, and minmax sets a minimum and maximum for each track. minmax(0,1fr) can allow a track to shrink below its content’s automatic minimum when that matches the design. auto-fit collapses unused repeated tracks while auto-fill retains them. Compare at multiple widths rather than memorizing a magic string.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:1rem; } article { padding:1rem; background:#e8eef7; overflow-wrap:anywhere; }Why it matters: The explicit grid uses three flexible tracks whose zero minimum avoids a common intrinsic-size overflow.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Media query
A conditional rule based on environmental features.
A media query conditionally applies rules according to the environment. Choose breakpoints where content needs them, not solely from device names. The browser evaluates width queries against the preview’s actual CSS viewport. The Responsive Lab reports active queries and measured overflow. Resize across both sides of the boundary and test the layout, not just the presence of a query.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display:grid; grid-template-columns:1fr; gap:1rem; } @media (min-width: 700px) { .layout { grid-template-columns:1fr 1fr 1fr; } }Why it matters: The single-column default gains three columns only when the width condition matches.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Breakpoint
A condition at which content needs a layout adaptation.
A media query conditionally applies rules according to the environment. Choose breakpoints where content needs them, not solely from device names. The browser evaluates width queries against the preview’s actual CSS viewport. The Responsive Lab reports active queries and measured overflow. Resize across both sides of the boundary and test the layout, not just the presence of a query.
<div class="layout"><article>Discover</article><article>Experiment</article><article>Build</article></div>
.layout { display:grid; grid-template-columns:1fr; gap:1rem; } @media (min-width: 700px) { .layout { grid-template-columns:1fr 1fr 1fr; } }Why it matters: The single-column default gains three columns only when the width condition matches.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Container query
A conditional style based on an eligible ancestor container.
A size container query responds to an ancestor container’s dimensions rather than the viewport. Establish an eligible query container with container-type or container. A component can then adapt when placed in different page regions. Modern selectors such as :has express relationships but need target-browser checks. The lab uses CSS.supports and real match/computed information; it does not invent support for an unavailable feature.
<section class="container"><article class="card"><h1>Reusable report card</h1><p>Resize its container.</p></article></section>
.container { container-type:inline-size; max-width:40rem; } .card { padding:1rem; } @container (min-width: 400px) { .card { display:grid; grid-template-columns:1fr 1fr; } }Why it matters: The ancestor becomes a size-query container so the component’s layout can depend on available inline size.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Responsive design
Layout and content that adapt to available conditions and user needs.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Typography
The coordinated presentation of text for meaning and readability.
A typography system coordinates a small set of sizes, weights and spacing values. Hierarchy should reflect content structure rather than arbitrary scale changes. A max-width in ch is an approximate reading measure, not an exact character count. Keep body text, headings and interactive controls consistent, and verify that longer titles wrap gracefully.
<article class="prose"><h1>A useful design system</h1><p class="lead">Start with clear content.</p><p>Use a readable measure and consistent vertical rhythm for longer explanations.</p></article>
.prose { max-width: 65ch; margin-inline: auto; padding: 1rem; font: 18px/1.6 system-ui; } .lead { font-size: 1.25em; }Why it matters: The article has a controlled reading measure and a restrained lead-text size.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Contrast
A comparison of luminance under defined foreground/background assumptions.
Colors can be written as named values, hex, rgb or hsl, among other modern formats. Different notations may describe the same sRGB color. Alpha adds transparency, which changes the resulting contrast against the background. The contrast tool calculates opaque sRGB ratios and clearly states that scope. Do not infer accessibility from a color’s name or from its numerical lightness alone.
<p class="color-sample">A calm blue on white.</p>
.color-sample { color: rgb(35 79 155); background: white; }Why it matters: The text color is specified directly while the white background makes the contrast context explicit.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Design token
A named reusable design decision such as a semantic color role.
A design token names a reusable design decision, such as surface, text or space. Semantic names survive theme changes better than names such as blue-button. Tokens should have a small intentional scale and be tested for contrast in each combination. Keep primitive values and semantic roles understandable; an enormous token file is not automatically a better design system.
<section class="token-card"><h1>Consistent decisions</h1><p>Tokens connect components.</p></section>
:root { --space:16px; --surface:#edf2fb; --text:#172f54; } .token-card { padding:var(--space); background:var(--surface); color:var(--text); }Why it matters: The card reads its spacing and color roles from shared custom properties.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Custom property
A case-sensitive CSS variable participating in cascade and inheritance.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Pseudo-class
A selector for a state or structural relationship.
Specificity compares ID, class/attribute/pseudo-class, and type/pseudo-element contributions lexicographically after earlier cascade stages tie. It is not a decimal score. :where contributes zero; :is, :not and :has use the most specific argument. Inline styles and important declarations need additional cascade context. The calculator handles its documented selector grammar and flags unsupported nesting context rather than inventing a result.
<p id="notice" class="message">Specificity experiment</p>
.message { font-weight: 400; } #notice { font-weight: 700; }Why it matters: The matching ID selector has greater specificity than the class selector in this otherwise tied example.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Pseudo-element
A selector addressing a special or generated part.
Specificity compares ID, class/attribute/pseudo-class, and type/pseudo-element contributions lexicographically after earlier cascade stages tie. It is not a decimal score. :where contributes zero; :is, :not and :has use the most specific argument. Inline styles and important declarations need additional cascade context. The calculator handles its documented selector grammar and flags unsupported nesting context rather than inventing a result.
<p id="notice" class="message">Specificity experiment</p>
.message { font-weight: 400; } #notice { font-weight: 700; }Why it matters: The matching ID selector has greater specificity than the class selector in this otherwise tied example.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Transition
Interpolation when selected computed property values change.
A transition interpolates a property when its value changes. It needs a property with an animatable change and a nonzero duration. Use focus as well as hover when an effect communicates interaction. Avoid transition:all when only a few properties need motion, and respect reduced-motion preferences. The Animation Studio controls actual animations through browser APIs rather than drawing a pretend timeline.
<button class="motion">Hover or focus me</button>
.motion { background:#234f9b; color:white; transition: background-color 200ms ease; } .motion:hover,.motion:focus-visible { background:#713b12; } @media (prefers-reduced-motion:reduce) { .motion { transition:none; } }Why it matters: A state change can animate the background color, while reduced-motion users receive an immediate change.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Transform
A visual coordinate transformation that differs from normal-flow layout.
z-index participates within stacking contexts rather than ranking every element globally. Positioning, transforms, opacity and other features can establish new contexts. A child with a very large z-index cannot simply escape its ancestor’s stacking context. Compare the ancestor chain, not just the numeric value. Keep overlays rare and test that they do not obscure focus or content.
<div class="stage"><div class="back">Background card</div><div class="front">Foreground note</div></div>
.stage { position: relative; min-height: 10rem; } .back,.front { position:absolute; padding:2rem; } .back { background:#dae5f6; z-index:1; } .front { background:#ffe4b5; left:3rem; top:2rem; z-index:2; }Why it matters: The foreground note stacks above the other positioned sibling inside the same relevant context.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Keyframe
A named point in an animation’s property-value timeline.
Keyframes define values at points along an animation timeline. animation-name connects an element to a named keyframe rule. Duration, iteration and fill behavior determine what users see before and after active motion. Start with a subtle bounded effect and provide a reduced-motion alternative. A CSS keyframe definition alone does not animate anything until a matching animation is assigned.
<div class="pulse">Learning in motion</div>
@keyframes reveal { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } } .pulse { animation:reveal 600ms ease both; } @media (prefers-reduced-motion:reduce) { .pulse { animation:none; } }Why it matters: The named keyframes and animation assignment agree, producing a short reveal rather than an undefined animation.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Easing
The mapping from elapsed time to interpolated progress.
Easing controls how interpolated progress changes over time; it does not change the duration by itself. Linear movement has constant progress, while ease curves accelerate and decelerate. Steps create discrete changes. A timeline scrubber changes currentTime on actual browser animations, so it is meaningful only after an animation exists. Test whether motion helps the task rather than merely showing that it can move.
<div class="timing">Compare easing in the Animation Studio.</div>
@keyframes travel { to { transform:translateX(100px); } } .timing { display:inline-block; animation:travel 2s ease-in-out 2 alternate; }Why it matters: The easing curve controls progress within each two-second iteration; alternate reverses the return direction.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Developer tools
Browser facilities for inspecting DOM, styles, geometry, behavior and accessibility.
A complete HTML document includes a doctype, an html root with language, a head for metadata and a body for visible content. Developer tools expose the browser’s interpreted DOM and computed CSS, not just the original file. The academy inspector reports the actual sandbox DOM. Browser tools offer deeper debugging and accessibility inspection after export. A title belongs in head and appears in browser UI rather than as a visible body heading.
<!doctype html> <html lang="en"><head><meta charset="utf-8"><title>Alex’s journal</title></head><body><h1>Learning journal</h1><p>Inspect this page.</p></body></html>
Why it matters: The root declares English so assistive technologies have a language cue; the document title identifies the tab.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Static hosting
Serving files without an application backend executing per request.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Deployment
Making a reviewed project available at its intended hosting destination.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Relative path
A resource address resolved from the current document location.
An absolute URL includes a scheme and host; a relative path is resolved from the current document’s directory. A leading slash starts at the site root, not the current folder. File names are often case-sensitive after upload. In the Build Studio, project page links resolve against the active virtual file. Exported folders preserve the same relationship. Review internal links after renaming a page.
<h1>Path examples</h1> <a href="about.html">About this project</a> <a href="https://developer.mozilla.org/">MDN documentation</a>
Why it matters: The first URL is a sibling file; the second is an absolute external destination.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Alternative text
A purpose-appropriate text equivalent for an image.
An img is a void element with no closing tag. src identifies the resource, while alt supplies a text alternative for its purpose. Decorative images generally use an empty alt rather than repeating irrelevant details. Width and height establish an aspect ratio and reduce layout shifts. The academy includes original local SVG illustrations; uploaded assets are restricted to supported raster image formats.
<h1>Coastal journal</h1>
<img src="assets/landscape.svg" width="640" height="400" alt="Layered blue hills beneath a pale morning sky">
img { max-width: 100%; height: auto; }Why it matters: The illustration has a purpose-specific text alternative and scales within its available width.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Accessible name
The programmatically determined label for an element or control.
A useful form needs visible labels, clear instructions, error associations and a predictable submit path. Required state should be explained in words rather than indicated by color alone. Native validation can help, but server validation is still necessary for real data. Use aria-describedby to connect help text without replacing the control’s accessible name.
<form><label for="full-name">Full name (required)</label><input id="full-name" name="name" required aria-describedby="name-help"><p id="name-help">Enter the name for your certificate.</p><button>Preview certificate</button></form>
label,input { display:block; }Why it matters: The visible label names the control and help text adds context without being the only name.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Focus indicator
A visible sign of the keyboard’s current interaction target.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Source order
The document sequence followed by reading and keyboard navigation in normal cases.
The cascade filters applicable declarations and orders them by origin and importance, layers, specificity, scoping proximity where relevant and source order. Specificity alone is not a universal winning score. This small example isolates same-origin, same-layer, equal-specificity source order so the later declaration wins. The rule inspector lists candidates and computed values; it does not pretend to reconstruct every browser cascade decision.
<p class="message">Which declaration wins?</p>
.message { color: red; }
.message { color: #234f9b; }Why it matters: With equal cascade priority and specificity, the later blue declaration overrides the earlier red declaration.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Stacking context
A self-contained ordering context for layered content.
z-index participates within stacking contexts rather than ranking every element globally. Positioning, transforms, opacity and other features can establish new contexts. A child with a very large z-index cannot simply escape its ancestor’s stacking context. Compare the ancestor chain, not just the numeric value. Keep overlays rare and test that they do not obscure focus or content.
<div class="stage"><div class="back">Background card</div><div class="front">Foreground note</div></div>
.stage { position: relative; min-height: 10rem; } .back,.front { position:absolute; padding:2rem; } .back { background:#dae5f6; z-index:1; } .front { background:#ffe4b5; left:3rem; top:2rem; z-index:2; }Why it matters: The foreground note stacks above the other positioned sibling inside the same relevant context.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Overflow
Content extending beyond a box’s available area.
A figure groups self-contained content with an optional figcaption. The caption adds context; alt still describes an image’s relevant information. max-width prevents overflow while height:auto preserves the intrinsic ratio. Responsive source selection with picture or srcset changes the resource chosen by the browser, whereas CSS changes display size. Test both rather than assuming one solves the other.
<figure><img src="assets/landscape.svg" width="640" height="400" alt="Blue hill shapes"><figcaption>Original study illustration: layered landscape.</figcaption></figure>
figure { margin: 0; } img { max-width: 100%; height: auto; }Why it matters: The caption belongs to the figure and the image keeps its aspect ratio as the viewport narrows.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Intrinsic size
A size derived from content or a replaced resource rather than only a specified length.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
CSS pixel
A reference unit used in CSS layout, distinct from physical device pixels.
A useful page title describes the specific page. The meta description summarizes its content but is not a guaranteed search-result snippet. The viewport meta element asks mobile browsers to use the device width in CSS pixels; it does not make a fixed-width layout responsive by itself. Keep metadata accurate instead of stuffing keywords. The academy’s exported document includes a complete shell, and authored full documents retain their own metadata.
<!doctype html><html lang="en"><head><title>Workshop registration — Field Notes</title><meta name="description" content="Register for a practical web design workshop."><meta name="viewport" content="width=device-width, initial-scale=1"></head><body><h1>Workshop registration</h1></body></html>
Why it matters: The page has a specific title and a concise description associated with the actual registration content.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Progressive enhancement
Providing usable content first and adding supported capabilities.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Reduced motion
A user preference for limiting nonessential animated movement.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Validation
Checking data or structure against an explicit contract.
A form groups controls whose named values can be submitted. HTML alone does not deliver email or store a registration. A real destination requires a server or configured service, plus validation and privacy decisions. In the academy, submissions are intercepted locally and reported as sample data. Use a submit button so keyboard and pointer users share the same form pathway.
<form><label>Name <input name="name" autocomplete="name" required></label><button type="submit">Preview registration</button></form><p>No real data is sent in this example.</p>
label { display:block; margin-bottom:1rem; }Why it matters: The button participates in native form submission, which the sandbox reports locally without sending data.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Computed style
A browser-resolved presentation value for a particular element.
A stylesheet contains rules. A selector identifies elements, and declarations assign property/value pairs. CSS is interpreted independently of HTML structure, so a rule matching no elements has no visible effect. Start with one property and compare before combining many changes. The browser’s computed style reveals which value actually won, while the rule list shows candidate declarations.
<h1>A styled heading</h1><p>The content stays meaningful.</p>
h1 { color: #234f9b; }Why it matters: Only the matched heading receives the blue text color; the paragraph keeps its inherited/default styling.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Iframe sandbox
An isolated embedded document with restricted capabilities.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
IndexedDB
Browser-local structured storage that can be cleared by the user or browser.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Vibe Learning
Discover, predict, understand, experiment, build, test, explain, reflect and extend.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Vibe Teaching
Teaching through observable problems, guided experiments and evidence-based explanation.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
Disciplined Vibe Coding
Using AI proposals while independently checking source, behavior and publication assumptions.
A website is a collection of resources that a browser retrieves and interprets. HTML describes content and meaning; the browser builds a document tree and applies default presentation even without CSS. An element consists of an opening tag, content and usually a closing tag. h1 identifies the page’s principal heading, while p marks a paragraph. The preview is a real browser document inside an isolated frame. Changing source does not affect the page until it is rendered again, unless automatic preview is enabled. Start by editing words rather than adding layout rules.
<h1>My First Website</h1> <p>I am learning HTML and CSS.</p>
Why it matters: One main heading appears above a paragraph. The heading is semantic content, not merely a large font.
Common misunderstanding: An attractive preview does not by itself prove the intended semantics, behavior or accessibility.
color
Sets the foreground text color; contrast depends on the actual background.
Grammar: <color>. Inherited: True. Layout context: block.
.sample { color: #17324d; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-color
Paints the background color behind content and padding.
Grammar: <color>. Inherited: False. Layout context: block.
.sample { background-color: #e3edf8; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-image
Adds a decorative background layer without replacing semantic content.
Grammar: <bg-image>#. Inherited: False. Layout context: block.
.sample { background-image: linear-gradient(120deg,#dce9fa,#f7dfc1); }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-size
Sizes each background image layer rather than the element itself.
Grammar: <bg-size>#. Inherited: False. Layout context: block.
.sample { background-size: 40px 40px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-position
Positions a background image inside its positioning area.
Grammar: <bg-position>#. Inherited: False. Layout context: block.
.sample { background-position: center; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-repeat
Controls whether a background image tiles.
Grammar: <repeat-style>#. Inherited: False. Layout context: block.
.sample { background-repeat: no-repeat; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-origin
Chooses the box used to position background images.
Grammar: <visual-box>#. Inherited: False. Layout context: block.
.sample { background-origin: content-box; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-clip
Limits the background painting area.
Grammar: <bg-clip>#. Inherited: False. Layout context: block.
.sample { background-clip: padding-box; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-attachment
Controls background scrolling behavior; test fixed backgrounds on target devices.
Grammar: <attachment>#. Inherited: False. Layout context: block.
.sample { background-attachment: scroll; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
background-blend-mode
Combines overlapping background layers through a blending operation.
Grammar: <blend-mode>#. Inherited: False. Layout context: block.
.sample { background-blend-mode: multiply; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
opacity
Makes the entire composited element translucent, including its content.
Grammar: <opacity-value>. Inherited: False. Layout context: block.
.sample { opacity: 0.7; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-family
Chooses a font stack with a generic fallback.
Grammar: [ <family-name> | <generic-family> ]#. Inherited: True. Layout context: block.
.sample { font-family: Georgia, serif; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-size
Sets the text size, subject to zoom and inherited context.
Grammar: <absolute-size> | <relative-size> | <length-percentage [0,∞]> | math. Inherited: True. Layout context: block.
.sample { font-size: 24px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-weight
Selects a supported weight; available faces affect the result.
Grammar: <font-weight-absolute> | bolder | lighter. Inherited: True. Layout context: block.
.sample { font-weight: 700; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-style
Selects an italic or oblique face/style where available.
Grammar: normal | italic | oblique <angle>?. Inherited: True. Layout context: block.
.sample { font-style: italic; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-variant
Requests typographic variants rather than changing the underlying text.
Grammar: normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]. Inherited: True. Layout context: block.
.sample { font-variant: small-caps; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-stretch
Requests a condensed font width when the chosen font supports it.
Grammar: <font-stretch-absolute>. Inherited: True. Layout context: block.
.sample { font-stretch: condensed; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-kerning
Controls adjustment of space between particular glyph pairs.
Grammar: auto | normal | none. Inherited: True. Layout context: block.
.sample { font-kerning: normal; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-feature-settings
Sets low-level font features supported by the selected font.
Grammar: normal | <feature-tag-value>#. Inherited: True. Layout context: block.
.sample { font-feature-settings: "liga" 1; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-variation-settings
Adjusts axes of a variable font when that font supplies them.
Grammar: normal | [ <string> <number> ]#. Inherited: True. Layout context: block.
.sample { font-variation-settings: "wght" 650; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-optical-sizing
Allows a font’s optical-size axis to adapt where supported.
Grammar: auto | none. Inherited: True. Layout context: block.
.sample { font-optical-sizing: auto; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
font-size-adjust
Adjusts apparent lowercase size across font fallbacks.
Grammar: none | [ ex-height | cap-height | ch-width | ic-width | ic-height ]? [ from-font | <number> ]. Inherited: True. Layout context: block.
.sample { font-size-adjust: 0.5; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
line-height
Controls baseline spacing; a unitless factor inherits usefully.
Grammar: normal | <number> | <length> | <percentage>. Inherited: True. Layout context: block.
.sample { line-height: 1.7; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
letter-spacing
Changes tracking between characters without inserting actual spaces.
Grammar: normal | <length>. Inherited: True. Layout context: block.
.sample { letter-spacing: 0.08em; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
word-spacing
Adjusts spacing between words.
Grammar: normal | <length>. Inherited: True. Layout context: block.
.sample { word-spacing: 0.3em; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-align
Aligns inline content within a line box.
Grammar: start | end | left | right | center | justify | match-parent. Inherited: True. Layout context: block.
.sample { text-align: center; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-align-last
Controls alignment of the final line of a text block.
Grammar: auto | start | end | left | right | center | justify. Inherited: True. Layout context: block.
.sample { text-align-last: start; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-indent
Indents the first formatted line.
Grammar: <length-percentage> && hanging? && each-line?. Inherited: True. Layout context: block.
.sample { text-indent: 2em; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-transform
Transforms presentation without rewriting source text.
Grammar: none | [ capitalize | uppercase | lowercase ] || full-width || full-size-kana | math-auto. Inherited: True. Layout context: block.
.sample { text-transform: uppercase; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-decoration
Adds a text decoration; avoid confusing non-links with links.
Grammar: <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>. Inherited: False. Layout context: block.
.sample { text-decoration: underline; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-decoration-color
Colors the decoration separately from glyphs.
Grammar: <color>. Inherited: False. Layout context: block.
.sample { text-decoration-color: #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-decoration-line
Chooses the decoration lines.
Grammar: none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error. Inherited: False. Layout context: block.
.sample { text-decoration-line: underline overline; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-decoration-style
Chooses the decoration stroke pattern.
Grammar: solid | double | dotted | dashed | wavy. Inherited: False. Layout context: block.
.sample { text-decoration-style: wavy; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-decoration-thickness
Sets decoration thickness.
Grammar: auto | from-font | <length> | <percentage>. Inherited: False. Layout context: block.
.sample { text-decoration-thickness: 3px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-underline-offset
Moves an underline away from its default position.
Grammar: auto | <length> | <percentage>. Inherited: True. Layout context: block.
.sample { text-underline-offset: 0.2em; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-shadow
Adds a visual text shadow; preserve readability.
Grammar: none | <shadow-t>#. Inherited: True. Layout context: block.
.sample { text-shadow: 2px 2px 3px #a8b8c8; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-overflow
Signals clipped inline overflow when other necessary constraints exist.
Grammar: [ clip | ellipsis | <string> ]{1,2}. Inherited: False. Layout context: constrained scrolling box.
.sample { text-overflow: ellipsis; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
white-space
Preserves whitespace while allowing wrapping.
Grammar: normal | pre | pre-wrap | pre-line | <'white-space-collapse'> || <'text-wrap-mode'>. Inherited: True. Layout context: block.
.sample { white-space: pre-wrap; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
overflow-wrap
Permits long unbroken text to wrap to avoid overflow.
Grammar: normal | break-word | anywhere. Inherited: True. Layout context: constrained scrolling box.
.sample { overflow-wrap: anywhere; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
word-break
Controls word-breaking rules; language affects behavior.
Grammar: normal | break-all | keep-all | break-word | auto-phrase. Inherited: True. Layout context: block.
.sample { word-break: normal; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
hyphens
Permits automatic hyphenation when language and dictionaries support it.
Grammar: none | manual | auto. Inherited: True. Layout context: block.
.sample { hyphens: auto; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-wrap
Requests balanced wrapping where supported; check actual browser behavior.
Grammar: <'text-wrap-mode'> || <'text-wrap-style'>. Inherited: True. Layout context: block.
.sample { text-wrap: balance; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
vertical-align
Aligns inline-level or table-cell content, not arbitrary block boxes.
Grammar: baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>. Inherited: False. Layout context: block.
.sample { vertical-align: middle; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
direction
Sets base inline direction; use HTML dir for content direction where appropriate.
Grammar: ltr | rtl. Inherited: True. Layout context: block.
.sample { direction: rtl; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
unicode-bidi
Isolates bidirectional text interactions.
Grammar: normal | embed | isolate | bidi-override | isolate-override | plaintext. Inherited: False. Layout context: block.
.sample { unicode-bidi: isolate; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
writing-mode
Changes the direction of text flow and logical axes.
Grammar: horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr. Inherited: True. Layout context: block.
.sample { writing-mode: vertical-rl; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
text-orientation
Controls glyph orientation in vertical writing modes.
Grammar: mixed | upright | sideways. Inherited: True. Layout context: block.
.sample { text-orientation: mixed; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
width
Sets preferred box width, interpreted by box-sizing.
Grammar: auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { width: 240px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
height
Sets preferred box height; fixed heights can clip growing content.
Grammar: auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { height: 140px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
min-width
Constrains the minimum width.
Grammar: auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { min-width: 160px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
max-width
Constrains the maximum width without requiring a fixed width.
Grammar: none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { max-width: 28rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
min-height
Provides a minimum height while allowing growth.
Grammar: auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { min-height: 8rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
max-height
Constrains height; pair with deliberate overflow behavior.
Grammar: none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>. Inherited: False. Layout context: block.
.sample { max-height: 12rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inline-size
Sets preferred size along the logical inline axis.
Grammar: <'width'>. Inherited: False. Layout context: block.
.sample { inline-size: 260px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
block-size
Sets preferred size along the logical block axis.
Grammar: <'width'>. Inherited: False. Layout context: block.
.sample { block-size: 140px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
min-inline-size
Constrains minimum logical inline size.
Grammar: <'min-width'>. Inherited: False. Layout context: block.
.sample { min-inline-size: 160px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
max-inline-size
Constrains maximum logical inline size.
Grammar: <'max-width'>. Inherited: False. Layout context: block.
.sample { max-inline-size: 30rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
min-block-size
Constrains minimum logical block size.
Grammar: <'min-width'>. Inherited: False. Layout context: block.
.sample { min-block-size: 8rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
max-block-size
Constrains maximum logical block size.
Grammar: <'max-width'>. Inherited: False. Layout context: block.
.sample { max-block-size: 15rem; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
aspect-ratio
Provides a preferred width-to-height ratio when sizing allows.
Grammar: auto || <ratio>. Inherited: False. Layout context: replaced image.
.sample { aspect-ratio: 16 / 9; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
box-sizing
Includes padding and border in specified dimensions; margin remains outside.
Grammar: content-box | border-box. Inherited: False. Layout context: block.
.sample { box-sizing: border-box; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-top
Sets top internal spacing.
Grammar: <length-percentage [0,∞]>. Inherited: False. Layout context: block.
.sample { padding-top: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-right
Sets right internal spacing in physical coordinates.
Grammar: <length-percentage [0,∞]>. Inherited: False. Layout context: block.
.sample { padding-right: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-bottom
Sets bottom internal spacing.
Grammar: <length-percentage [0,∞]>. Inherited: False. Layout context: block.
.sample { padding-bottom: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-left
Sets left internal spacing in physical coordinates.
Grammar: <length-percentage [0,∞]>. Inherited: False. Layout context: block.
.sample { padding-left: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-inline
Sets internal spacing on logical inline edges.
Grammar: <'padding-top'>{1,2}. Inherited: False. Layout context: block.
.sample { padding-inline: 24px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-block
Sets internal spacing on logical block edges.
Grammar: <'padding-top'>{1,2}. Inherited: False. Layout context: block.
.sample { padding-block: 16px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-inline-start
Sets internal spacing at the logical inline start.
Grammar: <'padding-top'>. Inherited: False. Layout context: block.
.sample { padding-inline-start: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-inline-end
Sets internal spacing at the logical inline end.
Grammar: <'padding-top'>. Inherited: False. Layout context: block.
.sample { padding-inline-end: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-block-start
Sets internal spacing at the logical block start.
Grammar: <'padding-top'>. Inherited: False. Layout context: block.
.sample { padding-block-start: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
padding-block-end
Sets internal spacing at the logical block end.
Grammar: <'padding-top'>. Inherited: False. Layout context: block.
.sample { padding-block-end: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-top
Sets the top external margin.
Grammar: <length-percentage> | auto | <anchor-size()>. Inherited: False. Layout context: block.
.sample { margin-top: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-right
Sets the right external margin.
Grammar: <length-percentage> | auto | <anchor-size()>. Inherited: False. Layout context: block.
.sample { margin-right: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-bottom
Sets the bottom external margin.
Grammar: <length-percentage> | auto | <anchor-size()>. Inherited: False. Layout context: block.
.sample { margin-bottom: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-left
Sets the left external margin.
Grammar: <length-percentage> | auto | <anchor-size()>. Inherited: False. Layout context: block.
.sample { margin-left: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-inline
Can center an appropriately sized block along the inline axis.
Grammar: <'margin-top'>{1,2}. Inherited: False. Layout context: block.
.sample { margin-inline: auto; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-block
Sets logical block-axis separation.
Grammar: <'margin-top'>{1,2}. Inherited: False. Layout context: block.
.sample { margin-block: 24px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-inline-start
Sets external spacing at the logical inline start.
Grammar: <'margin-top'>. Inherited: False. Layout context: block.
.sample { margin-inline-start: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-inline-end
Sets external spacing at the logical inline end.
Grammar: <'margin-top'>. Inherited: False. Layout context: block.
.sample { margin-inline-end: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-block-start
Sets external spacing at the logical block start.
Grammar: <'margin-top'>. Inherited: False. Layout context: block.
.sample { margin-block-start: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
margin-block-end
Sets external spacing at the logical block end.
Grammar: <'margin-top'>. Inherited: False. Layout context: block.
.sample { margin-block-end: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-width
Sets border thickness, visible when a non-none border style applies.
Grammar: <line-width>{1,4}. Inherited: False. Layout context: block.
.sample { border-width: 4px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-style
Sets the border stroke pattern.
Grammar: <line-style>{1,4}. Inherited: False. Layout context: block.
.sample { border-style: dashed; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-color
Sets border color independently of width and style.
Grammar: <color>{1,4}. Inherited: False. Layout context: block.
.sample { border-color: #234f9b; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-top
Styles the top border.
Grammar: <line-width> || <line-style> || <color>. Inherited: False. Layout context: block.
.sample { border-top: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-right
Styles the right border.
Grammar: <line-width> || <line-style> || <color>. Inherited: False. Layout context: block.
.sample { border-right: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-bottom
Styles the bottom border.
Grammar: <line-width> || <line-style> || <color>. Inherited: False. Layout context: block.
.sample { border-bottom: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-left
Styles the left border.
Grammar: <line-width> || <line-style> || <color>. Inherited: False. Layout context: block.
.sample { border-left: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-inline
Styles the borders at logical inline edges.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-inline: 4px solid #234f9b; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-block
Styles the borders at logical block edges.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-block: 4px solid #234f9b; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-inline-start
Styles the logical inline-start border.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-inline-start: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-inline-end
Styles the logical inline-end border.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-inline-end: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-block-start
Styles the logical block-start border.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-block-start: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-block-end
Styles the logical block-end border.
Grammar: <'border-top'>. Inherited: False. Layout context: block.
.sample { border-block-end: 4px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-radius
Rounds border corners without changing the box’s dimensions.
Grammar: <length-percentage [0,∞]>{1,4} [ / <length-percentage [0,∞]>{1,4} ]?. Inherited: False. Layout context: block.
.sample { border-radius: 24px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-top-left-radius
Rounds the top-left corner.
Grammar: <length-percentage [0,∞]>{1,2}. Inherited: False. Layout context: block.
.sample { border-top-left-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-top-right-radius
Rounds the top-right corner.
Grammar: <length-percentage [0,∞]>{1,2}. Inherited: False. Layout context: block.
.sample { border-top-right-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-bottom-left-radius
Rounds the bottom-left corner.
Grammar: <length-percentage [0,∞]>{1,2}. Inherited: False. Layout context: block.
.sample { border-bottom-left-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-bottom-right-radius
Rounds the bottom-right corner.
Grammar: <length-percentage [0,∞]>{1,2}. Inherited: False. Layout context: block.
.sample { border-bottom-right-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-start-start-radius
Rounds a corner relative to writing mode and direction.
Grammar: <'border-top-left-radius'>. Inherited: False. Layout context: block.
.sample { border-start-start-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-start-end-radius
Rounds the logical start/end corner.
Grammar: <'border-top-left-radius'>. Inherited: False. Layout context: block.
.sample { border-start-end-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-end-start-radius
Rounds the logical end/start corner.
Grammar: <'border-top-left-radius'>. Inherited: False. Layout context: block.
.sample { border-end-start-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
border-end-end-radius
Rounds the logical end/end corner.
Grammar: <'border-top-left-radius'>. Inherited: False. Layout context: block.
.sample { border-end-end-radius: 32px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
outline
Draws an outline without consuming normal box-model space.
Grammar: <'outline-width'> || <'outline-style'> || <'outline-color'>. Inherited: False. Layout context: block.
.sample { outline: 3px solid #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
outline-width
Sets outline thickness when an outline style is present.
Grammar: <line-width>. Inherited: False. Layout context: block.
.sample { outline-width: 4px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
outline-style
Sets the outline pattern; do not remove focus indicators without replacement.
Grammar: auto | <outline-line-style>. Inherited: False. Layout context: block.
.sample { outline-style: dashed; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
outline-color
Sets outline color.
Grammar: auto | <color>. Inherited: False. Layout context: block.
.sample { outline-color: #a44322; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
outline-offset
Separates an outline from the element’s edge.
Grammar: <length>. Inherited: False. Layout context: block.
.sample { outline-offset: 5px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
box-shadow
Adds a shadow without participating in normal-flow sizing.
Grammar: none | <shadow>#. Inherited: False. Layout context: block.
.sample { box-shadow: 0 12px 28px #17324d33; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
display
Selects outer/inner display behavior; Grid establishes a layout context.
Grammar: [ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>. Inherited: False. Layout context: block.
.sample { display: grid; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
visibility
Hides the box visually while commonly retaining its layout space.
Grammar: visible | hidden | collapse. Inherited: True. Layout context: block.
.sample { visibility: hidden; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
position
Establishes positioned behavior while retaining normal-flow space.
Grammar: static | relative | absolute | sticky | fixed. Inherited: False. Layout context: positioned box.
.sample { position: relative; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
top
Offsets a positioned element along the top axis.
Grammar: auto | <length-percentage> | <anchor()> | <anchor-size()>. Inherited: False. Layout context: positioned box.
.sample { top: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
right
Sets the right inset for positioned layout.
Grammar: auto | <length-percentage> | <anchor()> | <anchor-size()>. Inherited: False. Layout context: positioned box.
.sample { right: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
bottom
Sets the bottom inset for positioned layout.
Grammar: auto | <length-percentage> | <anchor()> | <anchor-size()>. Inherited: False. Layout context: positioned box.
.sample { bottom: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
left
Offsets a positioned element along the left axis.
Grammar: auto | <length-percentage> | <anchor()> | <anchor-size()>. Inherited: False. Layout context: positioned box.
.sample { left: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset
Sets the four physical insets together.
Grammar: <'top'>{1,4}. Inherited: False. Layout context: positioned box.
.sample { inset: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset-inline
Sets logical inline insets for a positioned element.
Grammar: <'top'>{1,2}. Inherited: False. Layout context: block.
.sample { inset-inline: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset-block
Sets logical block insets for a positioned element.
Grammar: <'top'>{1,2}. Inherited: False. Layout context: block.
.sample { inset-block: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset-inline-start
Sets the logical inline-start inset.
Grammar: <'top'>. Inherited: False. Layout context: block.
.sample { inset-inline-start: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset-inline-end
Sets the logical inline-end inset.
Grammar: <'top'>. Inherited: False. Layout context: block.
.sample { inset-inline-end: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
inset-block-start
Sets the logical block-start inset.
Grammar: <'top'>. Inherited: False. Layout context: block.
.sample { inset-block-start: 12px; }Why it matters: Using this property in its correct context helps explain actual computed results instead of guessing from appearance.
Common misunderstanding: A recognized declaration can still depend on context, content, fonts or browser support.
EventTarget
An object capable of receiving event listeners and dispatching events.
An object capable of receiving event listeners and dispatching events. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let count = 0;
function handleClick() { count += 1; document.querySelector("#count").textContent = String(count); }
document.querySelector("#run").addEventListener("click", handleClick);Why it matters: Two clicks invoke the registered handler twice and display 2.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
addEventListener
Registers a callback for a named event without invoking it immediately.
Registers a callback for a named event without invoking it immediately. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let count = 0;
function handleClick() { count += 1; document.querySelector("#count").textContent = String(count); }
document.querySelector("#run").addEventListener("click", handleClick);Why it matters: Two clicks invoke the registered handler twice and display 2.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Event target
The original node at which an event was dispatched.
The original node at which an event was dispatched. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const order = [];
function record(label) { order.push(label); document.querySelector("#result").textContent = order.join(" > "); }
document.querySelector("#outer").addEventListener("click", () => record("capture"), true);
document.querySelector("#inner").addEventListener("click", () => record("target"));
document.querySelector("#outer").addEventListener("click", () => record("bubble"));Why it matters: One click records capture > target > bubble.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Event currentTarget
The node whose listener is currently running.
The node whose listener is currently running. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const order = [];
function record(label) { order.push(label); document.querySelector("#result").textContent = order.join(" > "); }
document.querySelector("#outer").addEventListener("click", () => record("capture"), true);
document.querySelector("#inner").addEventListener("click", () => record("target"));
document.querySelector("#outer").addEventListener("click", () => record("bubble"));Why it matters: One click records capture > target > bubble.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Capturing phase
The phase that visits ancestor listeners on the path toward the target.
The phase that visits ancestor listeners on the path toward the target. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const order = [];
function record(label) { order.push(label); document.querySelector("#result").textContent = order.join(" > "); }
document.querySelector("#outer").addEventListener("click", () => record("capture"), true);
document.querySelector("#inner").addEventListener("click", () => record("target"));
document.querySelector("#outer").addEventListener("click", () => record("bubble"));Why it matters: One click records capture > target > bubble.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Bubbling phase
The phase that visits ancestor listeners after the event target.
The phase that visits ancestor listeners after the event target. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const order = [];
function record(label) { order.push(label); document.querySelector("#result").textContent = order.join(" > "); }
document.querySelector("#outer").addEventListener("click", () => record("capture"), true);
document.querySelector("#inner").addEventListener("click", () => record("target"));
document.querySelector("#outer").addEventListener("click", () => record("bubble"));Why it matters: One click records capture > target > bubble.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Event delegation
A stable ancestor handles matching descendant actions at event time.
A stable ancestor handles matching descendant actions at event time. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-id]"); if (!button || !event.currentTarget.contains(button)) return; document.querySelector("#result").textContent = button.dataset.id; });Why it matters: A click on the nested span is routed to task a through its button.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
preventDefault
Cancels a cancelable event’s default action while leaving propagation separate.
Cancels a cancelable event’s default action while leaving propagation separate. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#form").addEventListener("submit", event => {
event.preventDefault();
const form = event.currentTarget;
document.querySelector("#result").textContent = "Hello " + new FormData(form).get("name");
});Why it matters: A local submission reads the named value Alex and displays Hello Alex.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
stopPropagation
Stops later propagation along the event path; it does not cancel a default action.
Stops later propagation along the event path; it does not cancel a default action. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const order = [];
function record(label) { order.push(label); document.querySelector("#result").textContent = order.join(" > "); }
document.querySelector("#outer").addEventListener("click", () => record("capture"), true);
document.querySelector("#inner").addEventListener("click", () => record("target"));
document.querySelector("#outer").addEventListener("click", () => record("bubble"));Why it matters: One click records capture > target > bubble.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
KeyboardEvent.key
The key value exposed by a keyboard event, such as Enter or Escape.
The key value exposed by a keyboard event, such as Enter or Escape. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#query").addEventListener("keydown", event => {
if (event.key === "Enter") { event.preventDefault(); document.querySelector("#result").textContent = "Search: " + event.currentTarget.value; }
if (event.key === "Escape") { event.currentTarget.value = ""; document.querySelector("#result").textContent = "Cleared"; }
});Why it matters: Enter records Search: DOM, and Escape provides a separate clear path.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
textContent
A text-safe property for reading or replacing node text without HTML parsing.
A text-safe property for reading or replacing node text without HTML parsing. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#update").addEventListener("click", () => {
document.querySelector("#status").textContent = "Complete";
});Why it matters: Clicking the button changes only the status span to Complete.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
innerHTML
A markup-parsing interface that requires trusted or correctly sanitized input.
A markup-parsing interface that requires trusted or correctly sanitized input. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#show").addEventListener("click", () => {
document.querySelector("#result").textContent = document.querySelector("#message").value;
});Why it matters: The image-like string is displayed literally and creates zero image elements.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
classList
A token-list interface for adding, removing and toggling classes.
A token-list interface for adding, removing and toggling classes. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#toggle").addEventListener("click", event => {
const active = document.querySelector("#card").classList.toggle("selected");
event.currentTarget.setAttribute("aria-pressed", String(active));
});Why it matters: The first click adds selected and aria-pressed=true; the second removes selection.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
createElement
Creates a detached element ready for safe text and attribute assignment.
Creates a detached element ready for safe text and attribute assignment. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const records = document.querySelector("#records");
document.querySelector("#add").addEventListener("click", () => {
const item = document.createElement("li");
item.textContent = "New record ";
const remove = document.createElement("button"); remove.textContent = "Remove"; remove.dataset.remove = "true";
item.append(remove); records.append(item);
});
records.addEventListener("click", event => { if (event.target.matches("button[data-remove]")) event.target.closest("li").remove(); });Why it matters: Add creates one li with a functioning Remove button; Remove deletes that li.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
DocumentFragment
A detached container whose children can be inserted into a document together.
A detached container whose children can be inserted into a document together. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#render").addEventListener("click", () => { const fragment = document.createDocumentFragment(); ["Alex", "Sam", "Taylor"].forEach(name => { const item = document.createElement("li"); item.textContent = name; fragment.append(item); }); document.querySelector("#list").replaceChildren(fragment); });Why it matters: Rendering creates exactly three items in Alex, Sam, Taylor order.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
replaceChildren
Replaces all children of a node with the supplied nodes or strings.
Replaces all children of a node with the supplied nodes or strings. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#render").addEventListener("click", () => { const fragment = document.createDocumentFragment(); ["Alex", "Sam", "Taylor"].forEach(name => { const item = document.createElement("li"); item.textContent = name; fragment.append(item); }); document.querySelector("#list").replaceChildren(fragment); });Why it matters: Rendering creates exactly three items in Alex, Sam, Taylor order.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
NodeList
A collection of nodes; querySelectorAll returns a static snapshot.
A collection of nodes; querySelectorAll returns a static snapshot. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#select").addEventListener("click", () => {
const first = document.querySelector(".record");
const all = document.querySelectorAll(".record");
document.querySelector("#result").textContent = first.textContent + " / " + all.length;
});Why it matters: The first .record is Alex and the static collection has two entries.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
HTMLCollection
A usually live collection of elements, such as element.children.
A usually live collection of elements, such as element.children. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#inspect").addEventListener("click", () => {
const root = document.querySelector("#root");
document.querySelector("#result").textContent = root.childNodes.length + " nodes / " + root.children.length + " elements";
});Why it matters: The root has a text node, a strong element and a comment: three nodes but one element.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
childNodes
All direct child nodes including text and comments.
All direct child nodes including text and comments. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#inspect").addEventListener("click", () => {
const root = document.querySelector("#root");
document.querySelector("#result").textContent = root.childNodes.length + " nodes / " + root.children.length + " elements";
});Why it matters: The root has a text node, a strong element and a comment: three nodes but one element.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
children
Direct element children, excluding text and comment nodes.
Direct element children, excluding text and comment nodes. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#inspect").addEventListener("click", () => {
const root = document.querySelector("#root");
document.querySelector("#result").textContent = root.childNodes.length + " nodes / " + root.children.length + " elements";
});Why it matters: The root has a text node, a strong element and a comment: three nodes but one element.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
parentElement
The element parent of a node, or null at a boundary.
The element parent of a node, or null at a boundary. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#relate").addEventListener("click", () => {
const alex = document.querySelector("#alex");
document.querySelector("#result").textContent = alex.parentElement.id + " / " + alex.nextElementSibling.textContent;
});Why it matters: Alex belongs to people and its next element sibling contains Sam.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
nextElementSibling
The next sibling that is an element, skipping text nodes.
The next sibling that is an element, skipping text nodes. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#relate").addEventListener("click", () => {
const alex = document.querySelector("#alex");
document.querySelector("#result").textContent = alex.parentElement.id + " / " + alex.nextElementSibling.textContent;
});Why it matters: Alex belongs to people and its next element sibling contains Sam.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
closest
Finds the nearest matching element along the node’s ancestor chain, including itself.
Finds the nearest matching element along the node’s ancestor chain, including itself. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-id]"); if (!button || !event.currentTarget.contains(button)) return; document.querySelector("#result").textContent = button.dataset.id; });Why it matters: A click on the nested span is routed to task a through its button.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
MutationObserver
Reports actual observed DOM mutations asynchronously.
Reports actual observed DOM mutations asynchronously. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#inspect").addEventListener("click", () => {
const card = document.querySelector("#card");
document.querySelector("#result").textContent = card.tagName + " / " + card.getAttribute("data-status") + " / " + card.querySelector("h2").textContent;
});Why it matters: The live node is ARTICLE, has status ready and contains the heading Review.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
IntersectionObserver
Reports target intersection observations using actual browser layout.
Reports target intersection observations using actual browser layout. JSDOM has no layout or IntersectionObserver. Tests do not manufacture intersection measurements; inspect actual callbacks in a supporting browser.
let observer;
if (typeof IntersectionObserver === "undefined") { document.querySelector("#result").textContent = "IntersectionObserver unavailable"; } else { observer = new IntersectionObserver(entries => { document.querySelector("#result").textContent = entries[0].isIntersecting ? "Intersecting" : "Outside"; }, {threshold: 0.5}); observer.observe(document.querySelector("#target")); }
document.querySelector("#stop").addEventListener("click", () => { observer?.disconnect(); document.querySelector("#result").textContent = "Stopped"; });Why it matters: Supporting browsers report actual intersection state; Stop disconnects the observer.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
ResizeObserver
Reports changes to an observed element’s size in a supporting browser.
Reports changes to an observed element’s size in a supporting browser. Actual width observation requires browser layout. Offline tests verify availability handling and cleanup only.
let observer;
if (typeof ResizeObserver === "undefined") { document.querySelector("#result").textContent = "ResizeObserver unavailable"; } else { observer = new ResizeObserver(entries => { document.querySelector("#result").textContent = "Observed width: " + Math.round(entries[0].contentRect.width); }); observer.observe(document.querySelector("#target")); }
document.querySelector("#stop").addEventListener("click", () => { observer?.disconnect(); document.querySelector("#result").textContent = "Stopped"; });Why it matters: The supported observer reports actual content width; Stop disconnects it.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
FormData
Collects successful named form controls as form entries.
Collects successful named form controls as form entries. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#booking").addEventListener("submit", event => { event.preventDefault(); const data = new FormData(event.currentTarget); document.querySelector("#result").textContent = data.get("name") + " / " + Number(data.get("seats")); });Why it matters: The submitted named values render Alex / 2.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Constraint validation
Native browser checks associated with control attributes and validity state.
Native browser checks associated with control attributes and validity state. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const raw = document.querySelector("#seats").value.trim(); const seats = Number(raw); const valid = raw !== "" && Number.isInteger(seats) && seats >= 1 && seats <= 5; document.querySelector("#result").textContent = valid ? "Accepted" : "Enter a whole number from 1 to 5"; });Why it matters: A seat count of 3 is accepted; zero, six and empty input are rejected.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-invalid
Communicates a control’s invalid state; it does not itself validate the input.
Communicates a control’s invalid state; it does not itself validate the input. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const field = document.querySelector("#email"); const valid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(field.value); field.setAttribute("aria-invalid", String(!valid)); document.querySelector("#email-error").textContent = valid ? "Email format accepted" : "Enter an email such as alex@example.com"; });Why it matters: Invalid email receives aria-invalid=true and an associated repair instruction.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-describedby
References text that supplies an accessible description.
References text that supplies an accessible description. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const field = document.querySelector("#email"); const valid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(field.value); field.setAttribute("aria-invalid", String(!valid)); document.querySelector("#email-error").textContent = valid ? "Email format accepted" : "Enter an email such as alex@example.com"; });Why it matters: Invalid email receives aria-invalid=true and an associated repair instruction.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-expanded
Exposes whether controlled disclosure content is expanded.
Exposes whether controlled disclosure content is expanded. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#toggle").addEventListener("click", event => {
const open = event.currentTarget.getAttribute("aria-expanded") !== "true";
event.currentTarget.setAttribute("aria-expanded", String(open));
document.querySelector("#panel").hidden = !open;
});Why it matters: Opening sets aria-expanded=true and removes the panel’s hidden state.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-controls
Identifies the element controlled by an interactive element.
Identifies the element controlled by an interactive element. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#menu").addEventListener("click", event => {
const expanded = event.currentTarget.getAttribute("aria-expanded") !== "true";
event.currentTarget.setAttribute("aria-expanded", String(expanded));
document.querySelector("#navigation").hidden = !expanded;
});Why it matters: Menu exposes the named navigation and updates its expanded state.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-selected
Communicates selection within patterns such as tabs.
Communicates selection within patterns such as tabs. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const tabs = [...document.querySelectorAll("[role=tab]")];
function select(index) { tabs.forEach((tab, i) => { const active = i === index; tab.setAttribute("aria-selected", String(active)); tab.tabIndex = active ? 0 : -1; document.getElementById(tab.getAttribute("aria-controls")).hidden = !active; }); tabs[index].focus(); }
tabs.forEach((tab, i) => { tab.addEventListener("click", () => select(i)); tab.addEventListener("keydown", event => { if (["ArrowRight", "ArrowLeft"].includes(event.key)) { event.preventDefault(); select((i + (event.key === "ArrowRight" ? 1 : tabs.length - 1)) % tabs.length); } }); });Why it matters: Selecting Practice reveals panel two and gives tab-two the selected entry point.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
aria-pressed
Communicates the state of a toggle button.
Communicates the state of a toggle button. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let muted = false;
document.querySelector("#mute").addEventListener("click", event => { muted = !muted; event.currentTarget.setAttribute("aria-pressed", String(muted)); document.querySelector("#result").textContent = muted ? "Audio muted" : "Audio on"; });Why it matters: Activation synchronizes the toggle’s pressed state and visible audio status.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Roving tabindex
A composite keyboard pattern with one current tab stop among related controls.
A composite keyboard pattern with one current tab stop among related controls. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const tabs = [...document.querySelectorAll("[role=tab]")];
function select(index) { tabs.forEach((tab, i) => { const active = i === index; tab.setAttribute("aria-selected", String(active)); tab.tabIndex = active ? 0 : -1; document.getElementById(tab.getAttribute("aria-controls")).hidden = !active; }); tabs[index].focus(); }
tabs.forEach((tab, i) => { tab.addEventListener("click", () => select(i)); tab.addEventListener("keydown", event => { if (["ArrowRight", "ArrowLeft"].includes(event.key)) { event.preventDefault(); select((i + (event.key === "ArrowRight" ? 1 : tabs.length - 1)) % tabs.length); } }); });Why it matters: Selecting Practice reveals panel two and gives tab-two the selected entry point.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Focus restoration
Returns focus to a logical prior control after temporary UI closes.
Returns focus to a logical prior control after temporary UI closes. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let opener;
document.querySelector("#open").addEventListener("click", event => { opener = event.currentTarget; document.querySelector("#panel").hidden = false; document.querySelector("#close").focus(); });
document.querySelector("#close").addEventListener("click", () => { document.querySelector("#panel").hidden = true; if (opener?.isConnected) opener.focus(); });Why it matters: Closing the panel hides it and returns focus to the opener.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Native dialog
The dialog element can provide browser-managed modal behavior through showModal.
The dialog element can provide browser-managed modal behavior through showModal. JSDOM does not implement showModal. The unsupported path is tested offline; native focus trapping, Escape and geometry require actual browser tests.
const dialog = document.querySelector("#dialog");
let opener;
document.querySelector("#open").addEventListener("click", event => { opener = event.currentTarget; if (typeof dialog.showModal !== "function") { document.querySelector("#result").textContent = "Native dialog unavailable in this environment"; return; } dialog.showModal(); document.querySelector("#result").textContent = "Open"; });
document.querySelector("#close").addEventListener("click", () => dialog.close());
dialog.addEventListener("close", () => { document.querySelector("#result").textContent = "Closed"; opener?.focus(); });Why it matters: On a supporting browser Open shows the native modal; Close restores focus to the opener.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Application state
Domain data from which a consistent interface is rendered.
Domain data from which a consistent interface is rendered. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const state = {id: "task-1", status: "Pending"};
function render() { document.querySelector("#status").textContent = state.status; document.querySelector("#state").textContent = JSON.stringify(state); }
document.querySelector("#complete").addEventListener("click", () => { state.status = "Complete"; render(); });
render();Why it matters: The state record and visible status agree on Complete after activation.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Render function
Projects current application state into the intended DOM.
Projects current application state into the intended DOM. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const state = {count: 0, limit: 2};
function render() { document.querySelector("#count").textContent = String(state.count); document.querySelector("#remaining").textContent = (state.limit - state.count) + " remaining"; document.querySelector("#add").disabled = state.count >= state.limit; }
document.querySelector("#add").addEventListener("click", () => { state.count += 1; render(); });
render();Why it matters: After two additions the count is 2, allowance is zero and Add is disabled.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Component root
A bounded container used to scope a reusable component’s queries and behavior.
A bounded container used to scope a reusable component’s queries and behavior. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
function mountCounter(root) { let count = 0; const output = root.querySelector("output"); root.querySelector("button").addEventListener("click", () => { count += 1; output.textContent = String(count); }); }
document.querySelectorAll(".counter").forEach(mountCounter);Why it matters: The second counter updates independently while the first remains zero.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Dependency boundary
An explicit interface that makes a component independently testable.
An explicit interface that makes a component independently testable. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
function createCounter(root, step) { let value = 0; const output = root.querySelector("output"); function add() { value += step; output.textContent = String(value); } root.querySelector("button").addEventListener("click", add); return {reset() { value = 0; output.textContent = "0"; }}; }
const counter = createCounter(document.querySelector("#counter"), 2);Why it matters: The configured step is two, so one activation displays 2.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Regression test
A reproducible check preserving a previously required behavior.
A reproducible check preserving a previously required behavior. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let count = 0;
document.querySelector("#increment").addEventListener("click", () => { count += 1; document.querySelector("#count").textContent = String(count); });
document.querySelector("#test").addEventListener("click", () => { count = 0; document.querySelector("#count").textContent = "0"; document.querySelector("#increment").click(); document.querySelector("#result").textContent = document.querySelector("#count").textContent === "1" ? "PASS: one click adds one" : "FAIL: unexpected counter result"; });Why it matters: The actual click handler passes a one-click counter assertion.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Mutation test
A deliberate source defect used to prove that a test can reject incorrect behavior.
A deliberate source defect used to prove that a test can reject incorrect behavior. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let count = 0;
document.querySelector("#increment").addEventListener("click", () => { count += 1; document.querySelector("#count").textContent = String(count); });
document.querySelector("#test").addEventListener("click", () => { count = 0; document.querySelector("#count").textContent = "0"; document.querySelector("#increment").click(); document.querySelector("#result").textContent = document.querySelector("#count").textContent === "1" ? "PASS: one click adds one" : "FAIL: unexpected counter result"; });Why it matters: The actual click handler passes a one-click counter assertion.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Origin-scoped storage
Browser data access associated with a scheme, host and port.
Browser data access associated with a scheme, host and port. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
const key = "discovery-ui-lesson-71";
function perform(action) { try { if (action === "write") localStorage.setItem(key, JSON.stringify({version: 1, value: "Sample"})); if (action === "remove") localStorage.removeItem(key); const raw = localStorage.getItem(key); document.querySelector("#result").textContent = raw ? JSON.parse(raw).value : "No saved sample"; } catch (error) { document.querySelector("#result").textContent = "Storage unavailable"; } }
["write", "read", "remove"].forEach(action => document.getElementById(action).addEventListener("click", () => perform(action)));Why it matters: Write and Read report Sample; Remove affects only the namespaced key.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Storage version
A field identifying the schema of a saved record for validation and migration.
A field identifying the schema of a saved record for validation and migration. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#migrate").addEventListener("click", () => { const old = {version: 1, note: "Review DOM"}; if (old.version !== 1 || typeof old.note !== "string") throw new Error("Unsupported record"); const current = {version: 2, notes: [old.note]}; document.querySelector("#result").textContent = JSON.stringify(current); });Why it matters: The migrated record is version two with one preserved note.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Storage migration
A validated transformation from a known older record shape to a newer one.
A validated transformation from a known older record shape to a newer one. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#migrate").addEventListener("click", () => { const old = {version: 1, note: "Review DOM"}; if (old.version !== 1 || typeof old.note !== "string") throw new Error("Unsupported record"); const current = {version: 2, notes: [old.note]}; document.querySelector("#result").textContent = JSON.stringify(current); });Why it matters: The migrated record is version two with one preserved note.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Fetch response.ok
A boolean indicating a response status in the successful 200–299 range.
A boolean indicating a response status in the successful 200–299 range. Node/JSDOM test injects an actual standards fetch function for this data URL. It does not certify a remote provider or bypass the isolated preview CSP.
document.querySelector("#load").addEventListener("click", async () => { try { const response = await fetch("data:application/json,%7B%22title%22%3A%22DOM%20Workshop%22%7D"); if (!response.ok) throw new Error("HTTP " + response.status); const data = await response.json(); document.querySelector("#result").textContent = data.title; } catch (error) { document.querySelector("#result").textContent = "Fetch unavailable: " + error.message; } });Why it matters: A permitted real data-URL fetch parses DOM Workshop; blocked fetches report an actual error.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Data URL fixture
A self-contained authored resource URL; it is not a remote provider integration.
A self-contained authored resource URL; it is not a remote provider integration. Node/JSDOM test injects an actual standards fetch function for this data URL. It does not certify a remote provider or bypass the isolated preview CSP.
document.querySelector("#load").addEventListener("click", async () => { try { const response = await fetch("data:application/json,%7B%22title%22%3A%22DOM%20Workshop%22%7D"); if (!response.ok) throw new Error("HTTP " + response.status); const data = await response.json(); document.querySelector("#result").textContent = data.title; } catch (error) { document.querySelector("#result").textContent = "Fetch unavailable: " + error.message; } });Why it matters: A permitted real data-URL fetch parses DOM Workshop; blocked fetches report an actual error.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Timer handle
The identifier returned by a timer scheduling function for later cancellation.
The identifier returned by a timer scheduling function for later cancellation. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let timer;
document.querySelector("#start").addEventListener("click", () => { clearTimeout(timer); document.querySelector("#result").textContent = "Scheduled"; timer = setTimeout(() => { document.querySelector("#result").textContent = "Completed"; }, 30); });
document.querySelector("#cancel").addEventListener("click", () => { clearTimeout(timer); document.querySelector("#result").textContent = "Canceled"; });Why it matters: The scheduled callback eventually displays Completed; Cancel prevents the pending update.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Minimum timer delay
A scheduling lower bound rather than a promise of exact callback timing.
A scheduling lower bound rather than a promise of exact callback timing. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let timer;
document.querySelector("#start").addEventListener("click", () => { clearTimeout(timer); document.querySelector("#result").textContent = "Scheduled"; timer = setTimeout(() => { document.querySelector("#result").textContent = "Completed"; }, 30); });
document.querySelector("#cancel").addEventListener("click", () => { clearTimeout(timer); document.querySelector("#result").textContent = "Canceled"; });Why it matters: The scheduled callback eventually displays Completed; Cancel prevents the pending update.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
performance.now
A monotonic local elapsed-time clock with implementation-dependent precision.
A monotonic local elapsed-time clock with implementation-dependent precision. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#measure").addEventListener("click", () => { const start = performance.now(); let sum = 0; for (let i = 1; i <= 1000; i++) sum += i; const elapsed = performance.now() - start; document.querySelector("#result").textContent = "Sum: " + sum + "; local elapsed ms: " + elapsed.toFixed(3); });Why it matters: The computation returns 500500; the measured local duration varies on every environment.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Layout measurement
An actual browser reading of calculated element geometry.
An actual browser reading of calculated element geometry. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#move").addEventListener("click", () => document.querySelector("#box").classList.toggle("moved"));Why it matters: Movement toggles a class whose transform declares a horizontal translation.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Paint
The rendering stage that draws visual output; a DOM timer does not isolate its duration.
The rendering stage that draws visual output; a DOM timer does not isolate its duration. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#move").addEventListener("click", () => document.querySelector("#box").classList.toggle("moved"));Why it matters: Movement toggles a class whose transform declares a horizontal translation.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
CSP
A content security policy constraining permitted resource loading and execution.
A content security policy constraining permitted resource loading and execution. Node/JSDOM test injects an actual standards fetch function for this data URL. It does not certify a remote provider or bypass the isolated preview CSP.
document.querySelector("#load").addEventListener("click", async () => { try { const response = await fetch("data:application/json,%7B%22title%22%3A%22DOM%20Workshop%22%7D"); if (!response.ok) throw new Error("HTTP " + response.status); const data = await response.json(); document.querySelector("#result").textContent = data.title; } catch (error) { document.querySelector("#result").textContent = "Fetch unavailable: " + error.message; } });Why it matters: A permitted real data-URL fetch parses DOM Workshop; blocked fetches report an actual error.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Opaque origin
An isolated origin that may deny access to origin-scoped stores.
An isolated origin that may deny access to origin-scoped stores. JSDOM test uses its own origin-scoped storage. Opaque iframe storage can be unavailable; test the explicit fallback in a real preview.
document.querySelector("#save").addEventListener("click", () => { try { const record = {version: 1, text: document.querySelector("#note").value}; localStorage.setItem("discovery-ui-lesson-64", JSON.stringify(record)); const saved = JSON.parse(localStorage.getItem("discovery-ui-lesson-64")); document.querySelector("#result").textContent = saved.text; } catch (error) { document.querySelector("#result").textContent = "Storage unavailable: work remains in this field"; } });Why it matters: Supported storage round-trips the note; a blocked sandbox reports the limitation.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Idempotent render
Rendering the same state again produces an equivalent interface without duplicate effects.
Rendering the same state again produces an equivalent interface without duplicate effects. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#render").addEventListener("click", () => { const fragment = document.createDocumentFragment(); ["Alex", "Sam", "Taylor"].forEach(name => { const item = document.createElement("li"); item.textContent = name; fragment.append(item); }); document.querySelector("#list").replaceChildren(fragment); });Why it matters: Rendering creates exactly three items in Alex, Sam, Taylor order.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Safe literal text
Displaying untrusted characters as text rather than treating them as executable markup.
Displaying untrusted characters as text rather than treating them as executable markup. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#show").addEventListener("click", () => {
document.querySelector("#result").textContent = document.querySelector("#message").value;
});Why it matters: The image-like string is displayed literally and creates zero image elements.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Lifecycle cleanup
Removing listeners, observers or timers when their component no longer needs them.
Removing listeners, observers or timers when their component no longer needs them. JSDOM has no layout or IntersectionObserver. Tests do not manufacture intersection measurements; inspect actual callbacks in a supporting browser.
let observer;
if (typeof IntersectionObserver === "undefined") { document.querySelector("#result").textContent = "IntersectionObserver unavailable"; } else { observer = new IntersectionObserver(entries => { document.querySelector("#result").textContent = entries[0].isIntersecting ? "Intersecting" : "Outside"; }, {threshold: 0.5}); observer.observe(document.querySelector("#target")); }
document.querySelector("#stop").addEventListener("click", () => { observer?.disconnect(); document.querySelector("#result").textContent = "Stopped"; });Why it matters: Supporting browsers report actual intersection state; Stop disconnects the observer.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
Fresh test state
A new declared starting state preventing previous interactions from contaminating results.
A new declared starting state preventing previous interactions from contaminating results. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
let count = 0;
document.querySelector("#increment").addEventListener("click", () => { count += 1; document.querySelector("#count").textContent = String(count); });
document.querySelector("#test").addEventListener("click", () => { count = 0; document.querySelector("#count").textContent = "0"; document.querySelector("#increment").click(); document.querySelector("#result").textContent = document.querySelector("#count").textContent === "1" ? "PASS: one click adds one" : "FAIL: unexpected counter result"; });Why it matters: The actual click handler passes a one-click counter assertion.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.
DOM-only test
A structural and event test without a real browser layout engine.
A structural and event test without a real browser layout engine. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.
document.querySelector("#measure").addEventListener("click", () => { const start = performance.now(); let sum = 0; for (let i = 1; i <= 1000; i++) sum += i; const elapsed = performance.now() - start; document.querySelector("#result").textContent = "Sum: " + sum + "; local elapsed ms: " + elapsed.toFixed(3); });Why it matters: The computation returns 500500; the measured local duration varies on every environment.
Common misunderstanding: This term does not imply complete accessibility, layout or production verification.