← Back

CSS Complete Tutorial

No matching CSS topic found. Try searching color, margin, flex, grid, media, transform, animation, selector, padding, z-index, or variables.
❮ Previous Topic 1 of 295 Next ❯

CSS Introduction

What it is

CSS means Cascading Style Sheets. It controls the visual presentation of HTML: colors, spacing, fonts, layout, animation, responsiveness, and print styles.

Beginner explanation

Think of HTML as the skeleton of a webpage and CSS as the design layer. HTML says what content exists; CSS says how it should look on screen, mobile, and print.

Developer explanation

A developer uses CSS to build consistent user interfaces. Good CSS is reusable, responsive, accessible, maintainable, and predictable. It should work across browsers and screen sizes without depending on fragile hacks.

Syntax / pattern

selector { property: value; }

Detailed example

/* Style all page headings */
h1 {
  color: #2563eb;
  font-size: 2rem;
}

/* Style reusable cards */
.card {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
Browser result / output:The page heading becomes blue and larger. Any element with class card gets padding, border, and rounded corners.

Important values / related concepts

Value / conceptMeaning / usage
CSS rolePresentation and layout
HTML roleMeaning and structure
JavaScript roleBehavior and interaction

Real-time production scope

  • Build landing pages, dashboards, admin panels, learning pages, login forms, and responsive layouts.
  • Create a design system with colors, spacing, typography, buttons, cards, and forms.
  • Keep HTML semantic and CSS responsible for visuals.

Common mistakes and fixes

  • Using CSS to hide bad HTML structure instead of fixing semantic HTML.
  • Repeating hardcoded values without variables/design tokens.
  • Building only for desktop and forgetting mobile layouts.

Practice task

Practice: Create an HTML card and style it with CSS for background, border, spacing, title color, and button style.

Official study links

❮ Previous Topic 2 of 295 Next ❯

CSS Rule Anatomy

What it is

A CSS rule has a selector and a declaration block. The selector chooses elements. The declarations define properties and values.

Beginner explanation

If you write `.button { color: white; background: blue; }`, `.button` finds the element and the declarations tell the browser how to paint it.

Developer explanation

CSS rules are applied through the cascade. When multiple rules target the same element, the browser decides the final value using origin, importance, specificity, source order, and inheritance.

Syntax / pattern

selector { property: value; property: value; }

Detailed example

.button {
  color: white;
  background-color: #2563eb;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}
Browser result / output:Elements with class button show white text, blue background, padding, and rounded corners.

Important values / related concepts

Value / conceptMeaning / usage
selectorTargets HTML elements
propertyThe style feature you want to control
valueThe setting assigned to the property
declarationproperty plus value
blockDeclarations inside braces

Real-time production scope

  • Use readable formatting: one declaration per line.
  • Group related rules logically.
  • Use comments for large sections, not every obvious line.

Common mistakes and fixes

  • Missing semicolons between declarations.
  • Forgetting the dot before class selectors.
  • Forgetting braces around declarations.

Practice task

Practice: Write a rule for `.profile-card` with background, padding, border-radius, and box-shadow.

Official study links

❮ Previous Topic 3 of 295 Next ❯

CSS Comments

What it is

CSS comments are notes inside stylesheets. They are ignored by the browser but visible in source files.

Beginner explanation

Use comments to separate sections such as reset, variables, layout, buttons, forms, and responsive rules.

Developer explanation

Comments help large teams understand intent. Do not store secrets or private notes in CSS comments because frontend files are visible to users.

Syntax / pattern

/* comment text */

Detailed example

/* ===== Buttons ===== */
.button {
  padding: 0.75rem 1rem;
}

/* TODO: Replace temporary color with design token */
.alert {
  color: #b91c1c;
}
Browser result / output:Comments do not affect the visible page; they only help developers reading the CSS.

Important values / related concepts

Value / conceptMeaning / usage
single formCSS has one comment syntax: /* ... */
not nestedAvoid nesting comments inside comments

Real-time production scope

  • Mark big file sections.
  • Explain unusual browser workaround.
  • Document design token decisions.

Common mistakes and fixes

  • Putting passwords/API keys in comments.
  • Over-commenting obvious declarations.
  • Leaving outdated TODO comments forever.

Practice task

Practice: Add section comments to a stylesheet: base, layout, components, utilities, responsive.

Official study links

❮ Previous Topic 4 of 295 Next ❯

Inline CSS

What it is

The `style` attribute writes CSS directly on one HTML element.

Beginner explanation

Inline CSS is quick for testing but not good for maintainable projects.

Developer explanation

Inline styles have high priority and are hard to reuse. Use them rarely, mostly for dynamic values set by JavaScript or email templates.

Syntax / pattern

style="property: value;"

Detailed example

<h1 style="color: #2563eb; font-size: 32px;">Learn CSS</h1>
Browser result / output:The h1 appears blue and 32px tall.

Important values / related concepts

Value / conceptMeaning / usage
Best forSmall demos, email templates, dynamic one-off values
Avoid forReusable app styling

Real-time production scope

  • Use external CSS for projects with multiple pages.
  • Keep critical CSS small and organized.
  • Load stylesheets in correct order.

Common mistakes and fixes

  • Using inline CSS everywhere.
  • Loading files in wrong order.
  • Creating circular imports.

Practice task

Practice: Create a small HTML page and apply styles using Inline CSS.

Official study links

❮ Previous Topic 5 of 295 Next ❯

Internal CSS

What it is

Internal CSS is written inside a `<style>` tag in the HTML `<head>`.

Beginner explanation

It keeps CSS in the same page, useful for small demos or single-file pages.

Developer explanation

Internal CSS loads with the document and avoids another file request, but large internal styles make HTML harder to maintain.

Syntax / pattern

<style> selector { property: value; } </style>

Detailed example

<style>
  .hero { background: #eff6ff; padding: 2rem; }
</style>
<section class="hero">Welcome</section>
Browser result / output:The hero section gets a light blue background and spacing.

Important values / related concepts

Value / conceptMeaning / usage
Best forSingle-file tutorials, prototypes, small landing pages
Avoid forLarge multi-page websites

Real-time production scope

  • Use external CSS for projects with multiple pages.
  • Keep critical CSS small and organized.
  • Load stylesheets in correct order.

Common mistakes and fixes

  • Using inline CSS everywhere.
  • Loading files in wrong order.
  • Creating circular imports.

Practice task

Practice: Create a small HTML page and apply styles using Internal CSS.

Official study links

❮ Previous Topic 6 of 295 Next ❯

External CSS

What it is

External CSS is stored in a separate `.css` file and linked using `<link rel="stylesheet">`.

Beginner explanation

This is the best approach for real websites because the same CSS file can style many pages.

Developer explanation

External CSS improves maintainability, caching, and separation of concerns. Organize files by base styles, layout, components, utilities, and pages.

Syntax / pattern

<link rel="stylesheet" href="css/styles.css">

Detailed example

<link rel="stylesheet" href="css/styles.css">

/* css/styles.css */
.card {
  padding: 1rem;
  border: 1px solid #ddd;
}
Browser result / output:All pages that link styles.css can use the `.card` class.

Important values / related concepts

Value / conceptMeaning / usage
Best forProduction websites and apps
BenefitReusable, cacheable, maintainable

Real-time production scope

  • Use external CSS for projects with multiple pages.
  • Keep critical CSS small and organized.
  • Load stylesheets in correct order.

Common mistakes and fixes

  • Using inline CSS everywhere.
  • Loading files in wrong order.
  • Creating circular imports.

Practice task

Practice: Create a small HTML page and apply styles using External CSS.

Official study links

❮ Previous Topic 7 of 295 Next ❯

CSS Import

What it is

`@import` loads another CSS file from inside a stylesheet.

Beginner explanation

It can split files, but it may delay loading compared with `<link>`.

Developer explanation

In production, prefer build tools or multiple `<link>` tags for critical CSS. Use `@import` carefully because it can create additional render-blocking requests.

Syntax / pattern

@import url("base.css");

Detailed example

@import url("tokens.css");
@import url("buttons.css");

.card {
  padding: 1rem;
}
Browser result / output:The imported files load before the later `.card` rule applies.

Important values / related concepts

Value / conceptMeaning / usage
Best forSmall demos or layered CSS organization
CautionMay impact performance

Real-time production scope

  • Use external CSS for projects with multiple pages.
  • Keep critical CSS small and organized.
  • Load stylesheets in correct order.

Common mistakes and fixes

  • Using inline CSS everywhere.
  • Loading files in wrong order.
  • Creating circular imports.

Practice task

Practice: Create a small HTML page and apply styles using CSS Import.

Official study links

❮ Previous Topic 8 of 295 Next ❯

Universal Selector

What it is

The universal selector targets every element.

Beginner explanation

Use it when you intentionally want a rule applied globally, such as box-sizing reset.

Developer explanation

The `*` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

* { property: value; }

Detailed example

* {
  box-sizing: border-box;
}
Browser result / output:All elements matching `*` receive `box-sizing: border-box`.

Important values / related concepts

Value / conceptMeaning / usage
Specificity0-0-0, very low
Common use* { box-sizing: border-box; }

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `*` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 9 of 295 Next ❯

Type Selector

What it is

A type selector targets all HTML elements with the same tag name.

Beginner explanation

Use it for base element styles like paragraphs, headings, tables, and images.

Developer explanation

The `p` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

p { property: value; }

Detailed example

p {
  line-height: 1.7;
}
Browser result / output:All elements matching `p` receive `line-height: 1.7`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesAll `<p>` elements
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `p` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 10 of 295 Next ❯

Class Selector

What it is

A class selector targets elements with a matching class attribute.

Beginner explanation

Class selectors are the most common reusable styling method.

Developer explanation

The `.card` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.card { property: value; }

Detailed example

.card {
  padding: 1rem;
}
Browser result / output:All elements matching `.card` receive `padding: 1rem`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesAll elements with `class="card"`
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.card` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 11 of 295 Next ❯

ID Selector

What it is

An ID selector targets one element with a matching id.

Beginner explanation

Use IDs for unique anchors or JavaScript hooks, not as your default styling strategy.

Developer explanation

The `#hero` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

#hero { property: value; }

Detailed example

#hero {
  background-color: #eff6ff;
}
Browser result / output:All elements matching `#hero` receive `background-color: #eff6ff`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesElement with `id="hero"`
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `#hero` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 12 of 295 Next ❯

Grouping Selector

What it is

A grouping selector applies the same declarations to multiple selectors.

Beginner explanation

Use it to avoid repeating shared styles.

Developer explanation

The `h1, h2, h3` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

h1, h2, h3 { property: value; }

Detailed example

h1, h2, h3 {
  font-family: Arial, sans-serif;
}
Browser result / output:All elements matching `h1, h2, h3` receive `font-family: Arial, sans-serif`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesAll h1, h2, and h3 elements
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `h1, h2, h3` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 13 of 295 Next ❯

Descendant Combinator

What it is

A descendant combinator targets elements inside another element at any depth.

Beginner explanation

Use it when child elements should inherit component context styles.

Developer explanation

The `.nav a` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.nav a { property: value; }

Detailed example

.nav a {
  text-decoration: none;
}
Browser result / output:All elements matching `.nav a` receive `text-decoration: none`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesAll links anywhere inside `.nav`
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.nav a` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 14 of 295 Next ❯

Child Combinator

What it is

A child combinator targets only direct children.

Beginner explanation

Use it when you do not want nested grandchildren to match.

Developer explanation

The `.menu > li` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.menu > li { property: value; }

Detailed example

.menu > li {
  list-style: none;
}
Browser result / output:All elements matching `.menu > li` receive `list-style: none`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesOnly li elements directly inside `.menu`
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.menu > li` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 15 of 295 Next ❯

Adjacent Sibling Combinator

What it is

The adjacent sibling combinator targets the next sibling immediately after another element.

Beginner explanation

Use it for spacing or introductory paragraph styling.

Developer explanation

The `h2 + p` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

h2 + p { property: value; }

Detailed example

h2 + p {
  margin-top: 0;
}
Browser result / output:All elements matching `h2 + p` receive `margin-top: 0`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesThe first p immediately after each h2
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `h2 + p` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 16 of 295 Next ❯

General Sibling Combinator

What it is

The general sibling combinator targets later siblings after another element.

Beginner explanation

Use it when all following siblings in the same parent need style.

Developer explanation

The `h2 ~ p` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

h2 ~ p { property: value; }

Detailed example

h2 ~ p {
  color: #4b5563;
}
Browser result / output:All elements matching `h2 ~ p` receive `color: #4b5563`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesAll p elements after an h2 in the same parent
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `h2 ~ p` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 17 of 295 Next ❯

Attribute Selector Exact

What it is

This selector targets elements with an exact attribute value.

Beginner explanation

Use it for styling specific form fields or data attributes.

Developer explanation

The `input[type="email"]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input[type="email"] { property: value; }

Detailed example

input[type="email"] {
  border-color: #2563eb;
}
Browser result / output:All elements matching `input[type="email"]` receive `border-color: #2563eb`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesEmail input fields
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input[type="email"]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 18 of 295 Next ❯

Attribute Selector Contains Word

What it is

This selector targets attributes containing a space-separated word.

Beginner explanation

Use it carefully; class selectors are usually clearer for classes.

Developer explanation

The `[class~="active"]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

[class~="active"] { property: value; }

Detailed example

[class~="active"] {
  font-weight: 700;
}
Browser result / output:All elements matching `[class~="active"]` receive `font-weight: 700`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesElements whose class list includes active
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `[class~="active"]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 19 of 295 Next ❯

Attribute Selector Starts With

What it is

This selector targets attribute values beginning with a string.

Beginner explanation

Useful for external links, phone links, or protocol-specific styling.

Developer explanation

The `a[href^="https"]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

a[href^="https"] { property: value; }

Detailed example

a[href^="https"] {
  color: #047857;
}
Browser result / output:All elements matching `a[href^="https"]` receive `color: #047857`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesLinks where href starts with https
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `a[href^="https"]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 20 of 295 Next ❯

Attribute Selector Ends With

What it is

This selector targets attribute values ending with a string.

Beginner explanation

Useful for file links such as PDFs, ZIPs, or images.

Developer explanation

The `a[href$=".pdf"]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

a[href$=".pdf"] { property: value; }

Detailed example

a[href$=".pdf"] {
  font-weight: 700;
}
Browser result / output:All elements matching `a[href$=".pdf"]` receive `font-weight: 700`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesLinks ending with .pdf
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `a[href$=".pdf"]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 21 of 295 Next ❯

Attribute Selector Contains Text

What it is

This selector targets attribute values containing a substring.

Beginner explanation

Useful for data attributes, but avoid overusing because it can match unexpectedly.

Developer explanation

The `[data-role*="admin"]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

[data-role*="admin"] { property: value; }

Detailed example

[data-role*="admin"] {
  outline: 2px solid #f59e0b;
}
Browser result / output:All elements matching `[data-role*="admin"]` receive `outline: 2px solid #f59e0b`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesElements where data-role contains admin
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `[data-role*="admin"]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 22 of 295 Next ❯

Case-Insensitive Attribute Selector

What it is

The `i` flag makes attribute value matching case-insensitive.

Beginner explanation

Useful when HTML might contain inconsistent casing.

Developer explanation

The `input[type="email" i]` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input[type="email" i] { property: value; }

Detailed example

input[type="email" i] {
  background: #f8fafc;
}
Browser result / output:All elements matching `input[type="email" i]` receive `background: #f8fafc`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesInputs whose type equals email regardless of case
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input[type="email" i]` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 23 of 295 Next ❯

Pseudo-class :hover

What it is

`:hover` styles an element when the pointer is over it.

Beginner explanation

Use hover for visual feedback, but do not rely on hover only because touch devices may not have hover.

Developer explanation

The `button:hover` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

button:hover { property: value; }

Detailed example

button:hover {
  background-color: #1d4ed8;
}
Browser result / output:All elements matching `button:hover` receive `background-color: #1d4ed8`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesButtons on mouse hover
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `button:hover` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 24 of 295 Next ❯

Pseudo-class :focus

What it is

`:focus` styles the element currently focused by keyboard, mouse, or script.

Beginner explanation

Critical for accessible forms and keyboard navigation.

Developer explanation

The `input:focus` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input:focus { property: value; }

Detailed example

input:focus {
  outline: 3px solid #93c5fd;
}
Browser result / output:All elements matching `input:focus` receive `outline: 3px solid #93c5fd`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesFocused input
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input:focus` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 25 of 295 Next ❯

Pseudo-class :focus-visible

What it is

`:focus-visible` targets focus that should visibly show focus indication.

Beginner explanation

Use it to show clear keyboard focus without over-styling mouse clicks.

Developer explanation

The `button:focus-visible` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

button:focus-visible { property: value; }

Detailed example

button:focus-visible {
  outline: 3px solid #f59e0b;
}
Browser result / output:All elements matching `button:focus-visible` receive `outline: 3px solid #f59e0b`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesKeyboard-focused buttons
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `button:focus-visible` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 26 of 295 Next ❯

Pseudo-class :active

What it is

`:active` styles an element while it is being activated.

Beginner explanation

Use it for pressed button/link feedback.

Developer explanation

The `a:active` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

a:active { property: value; }

Detailed example

a:active {
  transform: scale(0.98);
}
Browser result / output:All elements matching `a:active` receive `transform: scale(0.98)`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesLink while being clicked
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `a:active` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 27 of 295 Next ❯

Pseudo-class :visited

What it is

`:visited` styles links the user has already visited.

Beginner explanation

Browsers restrict which properties can be changed for privacy.

Developer explanation

The `a:visited` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

a:visited { property: value; }

Detailed example

a:visited {
  color: #7c3aed;
}
Browser result / output:All elements matching `a:visited` receive `color: #7c3aed`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesVisited links
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `a:visited` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 28 of 295 Next ❯

Pseudo-class :first-child

What it is

Targets an element that is the first child of its parent.

Beginner explanation

Use it to remove top borders/margins or highlight first item.

Developer explanation

The `li:first-child` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

li:first-child { property: value; }

Detailed example

li:first-child {
  font-weight: 700;
}
Browser result / output:All elements matching `li:first-child` receive `font-weight: 700`.

Important values / related concepts

Value / conceptMeaning / usage
Matchesli that is first child
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `li:first-child` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 29 of 295 Next ❯

Pseudo-class :last-child

What it is

Targets an element that is the last child of its parent.

Beginner explanation

Use it to remove bottom border or margin from last item.

Developer explanation

The `li:last-child` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

li:last-child { property: value; }

Detailed example

li:last-child {
  border-bottom: 0;
}
Browser result / output:All elements matching `li:last-child` receive `border-bottom: 0`.

Important values / related concepts

Value / conceptMeaning / usage
Matchesli that is last child
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `li:last-child` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 30 of 295 Next ❯

Pseudo-class :nth-child()

What it is

Targets children by position or formula.

Beginner explanation

Use it for striped tables, repeating cards, and alternating rows.

Developer explanation

The `tr:nth-child(even)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

tr:nth-child(even) { property: value; }

Detailed example

tr:nth-child(even) {
  background: #f8fafc;
}
Browser result / output:All elements matching `tr:nth-child(even)` receive `background: #f8fafc`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesEven table rows
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `tr:nth-child(even)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 31 of 295 Next ❯

Pseudo-class :nth-of-type()

What it is

Targets elements by type and position among same element type.

Beginner explanation

Useful when mixed element types make nth-child unsuitable.

Developer explanation

The `p:nth-of-type(2)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

p:nth-of-type(2) { property: value; }

Detailed example

p:nth-of-type(2) {
  color: #2563eb;
}
Browser result / output:All elements matching `p:nth-of-type(2)` receive `color: #2563eb`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesSecond paragraph among paragraphs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `p:nth-of-type(2)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 32 of 295 Next ❯

Pseudo-class :not()

What it is

Excludes elements that match a selector.

Beginner explanation

Use it to apply styles except for a specific state.

Developer explanation

The `.button:not(.disabled)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.button:not(.disabled) { property: value; }

Detailed example

.button:not(.disabled) {
  cursor: pointer;
}
Browser result / output:All elements matching `.button:not(.disabled)` receive `cursor: pointer`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesButtons that do not have disabled class
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.button:not(.disabled)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 33 of 295 Next ❯

Pseudo-class :is()

What it is

Groups selectors with the specificity of the most specific argument.

Beginner explanation

Use it to reduce repetition in complex selectors.

Developer explanation

The `:is(h1, h2, h3)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

:is(h1, h2, h3) { property: value; }

Detailed example

:is(h1, h2, h3) {
  line-height: 1.2;
}
Browser result / output:All elements matching `:is(h1, h2, h3)` receive `line-height: 1.2`.

Important values / related concepts

Value / conceptMeaning / usage
Matchesh1, h2, and h3
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `:is(h1, h2, h3)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 34 of 295 Next ❯

Pseudo-class :where()

What it is

Groups selectors with zero specificity.

Beginner explanation

Great for low-specificity base styles that are easy to override.

Developer explanation

The `:where(h1, h2, h3)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

:where(h1, h2, h3) { property: value; }

Detailed example

:where(h1, h2, h3) {
  margin-block: 0 0.5rem;
}
Browser result / output:All elements matching `:where(h1, h2, h3)` receive `margin-block: 0 0.5rem`.

Important values / related concepts

Value / conceptMeaning / usage
Matchesh1, h2, and h3
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `:where(h1, h2, h3)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 35 of 295 Next ❯

Pseudo-class :has()

What it is

Targets an element based on what it contains.

Beginner explanation

Use it for parent-aware styling such as cards with images or forms with invalid fields.

Developer explanation

The `.card:has(img)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.card:has(img) { property: value; }

Detailed example

.card:has(img) {
  padding-top: 0;
}
Browser result / output:All elements matching `.card:has(img)` receive `padding-top: 0`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesCards containing an img
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.card:has(img)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 36 of 295 Next ❯

Pseudo-class :checked

What it is

Targets checked checkboxes/radio buttons.

Beginner explanation

Use it for custom toggles and selected states.

Developer explanation

The `input:checked` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input:checked { property: value; }

Detailed example

input:checked {
  accent-color: #2563eb;
}
Browser result / output:All elements matching `input:checked` receive `accent-color: #2563eb`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesChecked inputs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input:checked` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 37 of 295 Next ❯

Pseudo-class :disabled

What it is

Targets disabled form controls.

Beginner explanation

Use it to show unavailable actions clearly.

Developer explanation

The `button:disabled` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

button:disabled { property: value; }

Detailed example

button:disabled {
  opacity: 0.5;
}
Browser result / output:All elements matching `button:disabled` receive `opacity: 0.5`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesDisabled buttons
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `button:disabled` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 38 of 295 Next ❯

Pseudo-class :valid

What it is

Targets form controls whose value satisfies constraints.

Beginner explanation

Use it for validation feedback but keep accessibility in mind.

Developer explanation

The `input:valid` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input:valid { property: value; }

Detailed example

input:valid {
  border-color: #16a34a;
}
Browser result / output:All elements matching `input:valid` receive `border-color: #16a34a`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesValid inputs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input:valid` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 39 of 295 Next ❯

Pseudo-class :invalid

What it is

Targets form controls whose value violates constraints.

Beginner explanation

Use it carefully so empty required fields do not show error before interaction if that hurts UX.

Developer explanation

The `input:invalid` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

input:invalid { property: value; }

Detailed example

input:invalid {
  border-color: #dc2626;
}
Browser result / output:All elements matching `input:invalid` receive `border-color: #dc2626`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesInvalid inputs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `input:invalid` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 40 of 295 Next ❯

Pseudo-element ::before

What it is

Creates a generated inline pseudo-element before content.

Beginner explanation

Use it for decorative icons, labels, and visual markers. Do not put essential content only in CSS.

Developer explanation

The `.badge::before` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.badge::before { property: value; }

Detailed example

.badge::before {
  content: "★ ";
}
Browser result / output:All elements matching `.badge::before` receive `content: "★ "`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesGenerated content before badge text
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.badge::before` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 41 of 295 Next ❯

Pseudo-element ::after

What it is

Creates a generated pseudo-element after content.

Beginner explanation

Use it for icons, arrows, badges, and decoration.

Developer explanation

The `.link::after` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

.link::after { property: value; }

Detailed example

.link::after {
  content: " →";
}
Browser result / output:All elements matching `.link::after` receive `content: " →"`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesGenerated content after link text
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `.link::after` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 42 of 295 Next ❯

Pseudo-element ::first-letter

What it is

Styles the first letter of text.

Beginner explanation

Use it for editorial drop caps or article intros.

Developer explanation

The `p::first-letter` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

p::first-letter { property: value; }

Detailed example

p::first-letter {
  font-size: 2rem;
}
Browser result / output:All elements matching `p::first-letter` receive `font-size: 2rem`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesFirst letter of paragraphs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `p::first-letter` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 43 of 295 Next ❯

Pseudo-element ::first-line

What it is

Styles the first formatted line of text.

Beginner explanation

Useful for magazine-like text intro styling.

Developer explanation

The `p::first-line` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

p::first-line { property: value; }

Detailed example

p::first-line {
  font-weight: 700;
}
Browser result / output:All elements matching `p::first-line` receive `font-weight: 700`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesFirst line of paragraphs
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `p::first-line` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 44 of 295 Next ❯

Pseudo-element ::selection

What it is

Styles text selected by the user.

Beginner explanation

Use it to match brand selection colors while maintaining contrast.

Developer explanation

The `::selection` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

::selection { property: value; }

Detailed example

::selection {
  background: #fde68a;
}
Browser result / output:All elements matching `::selection` receive `background: #fde68a`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesUser-selected text
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `::selection` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 45 of 295 Next ❯

Selector List Specificity

What it is

Selector lists apply to multiple selector options, but specificity rules can change with modern selectors.

Beginner explanation

Understand selector list specificity to avoid unexpected overrides.

Developer explanation

The `:is(.card, #hero)` selector controls which elements receive a CSS rule. Selectors affect maintainability and specificity. In production, prefer selectors that are clear, reusable, and not too tightly coupled to the HTML structure.

Syntax / pattern

:is(.card, #hero) { property: value; }

Detailed example

:is(.card, #hero) {
  border: 2px solid #2563eb;
}
Browser result / output:All elements matching `:is(.card, #hero)` receive `border: 2px solid #2563eb`.

Important values / related concepts

Value / conceptMeaning / usage
MatchesElements matching either selector
Specificity noteSpecificity depends on selector type: IDs are strongest, then classes/attributes/pseudo-classes, then elements.

Real-time production scope

  • Use simple selectors for reusable UI components.
  • Avoid deeply nested selectors that break when HTML structure changes.
  • Check specificity so future overrides remain easy.

Common mistakes and fixes

  • Using IDs for every style and making overrides difficult.
  • Writing selectors that are too broad and accidentally style unrelated elements.
  • Depending only on hover without keyboard/focus support.

Practice task

Practice: Create sample HTML that matches `:is(.card, #hero)` and verify exactly which elements are styled.

Official study links

❮ Previous Topic 46 of 295 Next ❯

Cascade

What it is

The cascade is the algorithm that chooses the final CSS value when multiple rules apply.

Beginner explanation

When two rules set the same property, the browser decides which one wins.

Developer explanation

The cascade considers origin, importance, cascade layers, specificity, scoping proximity, and source order. A good CSS architecture keeps this predictable.

Syntax / pattern

Earlier rule can be overridden by later rule with same specificity.

Detailed example

.title { color: blue; }
.title { color: red; }
Browser result / output:The title becomes red because the later rule wins when specificity is equal.

Important values / related concepts

Value / conceptMeaning / usage
main factorsimportance, origin, layer, specificity, source order

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why cascade behaves that way.

Official study links

❮ Previous Topic 47 of 295 Next ❯

Specificity

What it is

Specificity is a score that decides which selector is stronger.

Beginner explanation

ID selectors beat class selectors; class selectors beat element selectors.

Developer explanation

Specificity is often the reason CSS does not behave as expected. Keep specificity low so components can be changed easily.

Syntax / pattern

inline > #id > .class/:pseudo/[attr] > element

Detailed example

p { color: black; }
.note { color: blue; }
#message { color: red; }
Browser result / output:If one element is `<p id="message" class="note">`, the color becomes red.

Important values / related concepts

Value / conceptMeaning / usage
IDstrong
class/attribute/pseudo-classmedium
type/pseudo-elementlow

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why specificity behaves that way.

Official study links

❮ Previous Topic 48 of 295 Next ❯

Inheritance

What it is

Inheritance means some CSS properties pass from parent to child.

Beginner explanation

If you set font-family on body, child text usually uses it too.

Developer explanation

Not all properties inherit. Text properties often inherit; layout properties like margin, padding, border usually do not.

Syntax / pattern

child gets inherited value unless overridden

Detailed example

body { font-family: Arial, sans-serif; color: #111827; }
.card { border: 1px solid #ddd; }
Browser result / output:Text inside body inherits font and color. Border does not automatically apply to children.

Important values / related concepts

Value / conceptMeaning / usage
usually inheritscolor, font-family, font-size, line-height
usually not inheritmargin, padding, border, width

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why inheritance behaves that way.

Official study links

❮ Previous Topic 49 of 295 Next ❯

Source Order

What it is

Source order means later rules can override earlier rules when priority is otherwise equal.

Beginner explanation

If two same-strength rules style the same thing, the last one wins.

Developer explanation

Put base rules first, components next, utilities last if utilities should override components.

Syntax / pattern

first rule then later rule

Detailed example

.alert { color: orange; }
.alert { color: red; }
Browser result / output:The alert text is red.

Important values / related concepts

Value / conceptMeaning / usage
equal specificitylater wins
different specificitystronger selector may win even if earlier

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why source order behaves that way.

Official study links

❮ Previous Topic 50 of 295 Next ❯

!important

What it is

`!important` increases a declaration priority.

Beginner explanation

It can force a style to win, but it makes CSS harder to maintain.

Developer explanation

Use `!important` only for utilities, third-party overrides, or emergency fixes. Repeated use usually means specificity architecture is broken.

Syntax / pattern

property: value !important;

Detailed example

.text-red {
  color: red !important;
}
Browser result / output:The element becomes red unless another stronger important rule overrides it.

Important values / related concepts

Value / conceptMeaning / usage
use carefullyutility overrides, accessibility fixes
avoidnormal component styling

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why !important behaves that way.

Official study links

❮ Previous Topic 51 of 295 Next ❯

Cascade Layers @layer

What it is

`@layer` organizes CSS into explicit cascade layers.

Beginner explanation

Layers let you decide that utilities should override components, or app styles should override framework styles.

Developer explanation

Cascade layers are useful in design systems and when combining resets, third-party CSS, components, and utilities.

Syntax / pattern

@layer reset, base, components, utilities;

Detailed example

@layer reset, base, components, utilities;

@layer components {
  .button { color: white; background: blue; }
}

@layer utilities {
  .text-red { color: red; }
}
Browser result / output:Rules in later layers can override rules in earlier layers even with lower selector specificity in many cases.

Important values / related concepts

Value / conceptMeaning / usage
common layersreset, base, theme, components, utilities

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why cascade layers @layer behaves that way.

Official study links

❮ Previous Topic 52 of 295 Next ❯

Custom Property Inheritance

What it is

CSS custom properties usually inherit from parent elements.

Beginner explanation

If you define `--brand` on `:root`, all elements can use it.

Developer explanation

Use inherited variables for theming and component customization. Override variables on a subtree to theme only that area.

Syntax / pattern

--name: value; property: var(--name);

Detailed example

:root { --brand: #2563eb; }
.card { border-color: var(--brand); }
.admin-theme { --brand: #7c3aed; }
Browser result / output:Cards inside `.admin-theme` use purple; others use blue.

Important values / related concepts

Value / conceptMeaning / usage
scopevariables follow normal cascade and inheritance

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why custom property inheritance behaves that way.

Official study links

❮ Previous Topic 53 of 295 Next ❯

Computed Styles

What it is

Computed style is the final resolved style the browser applies after cascade and inheritance.

Beginner explanation

DevTools shows you exactly which rule wins and which rules are crossed out.

Developer explanation

Use computed styles to debug CSS instead of guessing. It shows inherited values, overridden values, layout sizes, and applied box model.

Syntax / pattern

Inspect element → Computed tab

Detailed example

/* If your color does not apply, inspect the element */
.button { color: white; }
Browser result / output:DevTools reveals whether another selector or inherited value is overriding the rule.

Important values / related concepts

Value / conceptMeaning / usage
best toolBrowser DevTools
use forspecificity, box model, font, layout debugging

Real-time production scope

  • Keep selectors simple.
  • Use DevTools to inspect overridden rules.
  • Use layers/tokens in large systems.

Common mistakes and fixes

  • Fighting CSS with `!important` everywhere.
  • Not checking computed styles.
  • Assuming all properties inherit.

Practice task

Practice: Create two conflicting rules for the same element and use DevTools to identify why computed styles behaves that way.

Official study links

❮ Previous Topic 54 of 295 Next ❯

px Unit

What it is

Pixels are fixed CSS units commonly used for borders, icons, and precise spacing.

Beginner explanation

A pixel value stays the same size in CSS layout terms.

Developer explanation

Use px for borders and fine details; avoid using only px for typography if users need scalable text.

Syntax / pattern

width: 300px;

Detailed example

.box { width: 300px; border: 1px solid #ddd; }
Browser result / output:The box has a fixed width of 300 CSS pixels.

Important values / related concepts

Value / conceptMeaning / usage
best forborders, small fixed measurements
cautionfixed widths can break mobile layout

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with px Unit where appropriate.

Official study links

❮ Previous Topic 55 of 295 Next ❯

% Unit

What it is

Percent values are relative to another size, usually the containing block or inherited property context.

Beginner explanation

50% width means half of the parent width.

Developer explanation

Percentages are fundamental for responsive layouts but behave differently depending on the property.

Syntax / pattern

width: 50%;

Detailed example

.card { width: 50%; }
Browser result / output:The card takes half of its parent width.

Important values / related concepts

Value / conceptMeaning / usage
relative toproperty-specific context
good forfluid widths

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with % Unit where appropriate.

Official study links

❮ Previous Topic 56 of 295 Next ❯

em Unit

What it is

`em` is relative to the current element's font size.

Beginner explanation

If font-size is 20px, 1em equals 20px.

Developer explanation

Use em when spacing should scale with component text size, but be aware that nested font sizes compound.

Syntax / pattern

padding: 1em;

Detailed example

.button { font-size: 18px; padding: 0.75em 1em; }
Browser result / output:Button padding scales with the button font size.

Important values / related concepts

Value / conceptMeaning / usage
relative tocurrent font-size
cautionnested em can compound

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with em Unit where appropriate.

Official study links

❮ Previous Topic 57 of 295 Next ❯

rem Unit

What it is

`rem` is relative to the root element font size.

Beginner explanation

Usually 1rem equals 16px unless the root font-size is changed.

Developer explanation

Use rem for consistent scalable spacing and typography across a site.

Syntax / pattern

font-size: 1.25rem;

Detailed example

.title { font-size: 2rem; margin-bottom: 1rem; }
Browser result / output:The title size and spacing scale from the root font size.

Important values / related concepts

Value / conceptMeaning / usage
relative tohtml/root font-size
best fortypography and spacing systems

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with rem Unit where appropriate.

Official study links

❮ Previous Topic 58 of 295 Next ❯

vw Unit

What it is

`vw` is viewport width unit. 1vw equals 1% of viewport width.

Beginner explanation

100vw means full browser width.

Developer explanation

Use carefully because 100vw can include scrollbar width and cause horizontal scroll.

Syntax / pattern

width: 100vw;

Detailed example

.hero { min-height: 60vh; width: 100%; }
Browser result / output:The hero can size relative to viewport dimensions.

Important values / related concepts

Value / conceptMeaning / usage
1vw1% viewport width
common usefluid hero text with clamp

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with vw Unit where appropriate.

Official study links

❮ Previous Topic 59 of 295 Next ❯

vh Unit

What it is

`vh` is viewport height unit. 1vh equals 1% of viewport height.

Beginner explanation

100vh means full viewport height.

Developer explanation

Mobile browsers can change viewport height as address bars appear/disappear. Consider `svh`, `lvh`, and `dvh` for mobile.

Syntax / pattern

min-height: 100vh;

Detailed example

.hero { min-height: 100vh; }
Browser result / output:Hero fills the viewport height.

Important values / related concepts

Value / conceptMeaning / usage
1vh1% viewport height
mobile cautionuse dvh/svh/lvh where appropriate

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with vh Unit where appropriate.

Official study links

❮ Previous Topic 60 of 295 Next ❯

dvh Unit

What it is

`dvh` is dynamic viewport height that updates with browser UI changes.

Beginner explanation

Useful on mobile where the visible viewport changes.

Developer explanation

Use `100dvh` for full-height mobile layouts that should respect dynamic viewport changes.

Syntax / pattern

min-height: 100dvh;

Detailed example

.login-page { min-height: 100dvh; }
Browser result / output:The login page fills the currently visible viewport.

Important values / related concepts

Value / conceptMeaning / usage
best formobile full-screen sections
supportmodern browsers

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with dvh Unit where appropriate.

Official study links

❮ Previous Topic 61 of 295 Next ❯

vmin Unit

What it is

`vmin` is 1% of the smaller viewport dimension.

Beginner explanation

It scales with whichever is smaller: width or height.

Developer explanation

Useful for responsive squares, icons, and typography that must fit both orientations.

Syntax / pattern

font-size: 5vmin;

Detailed example

.logo { width: 20vmin; height: 20vmin; }
Browser result / output:The logo stays proportional to the smaller viewport side.

Important values / related concepts

Value / conceptMeaning / usage
based onmin(viewport width, viewport height)

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with vmin Unit where appropriate.

Official study links

❮ Previous Topic 62 of 295 Next ❯

vmax Unit

What it is

`vmax` is 1% of the larger viewport dimension.

Beginner explanation

It scales with the larger of width or height.

Developer explanation

Use sparingly for large decorative elements.

Syntax / pattern

width: 20vmax;

Detailed example

.blob { width: 30vmax; height: 30vmax; }
Browser result / output:The decorative blob scales with the larger viewport side.

Important values / related concepts

Value / conceptMeaning / usage
based onmax(viewport width, viewport height)

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with vmax Unit where appropriate.

Official study links

❮ Previous Topic 63 of 295 Next ❯

ch Unit

What it is

`ch` is roughly the width of the `0` character in the current font.

Beginner explanation

It is useful for readable text line lengths.

Developer explanation

Use `max-width: 65ch` for articles so lines do not become too long.

Syntax / pattern

max-width: 65ch;

Detailed example

.article { max-width: 65ch; }
Browser result / output:Article text stays readable by limiting line length.

Important values / related concepts

Value / conceptMeaning / usage
best fortext containers
common range60-75ch for long reading

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with ch Unit where appropriate.

Official study links

❮ Previous Topic 64 of 295 Next ❯

fr Unit

What it is

`fr` is a CSS Grid flexible fraction unit.

Beginner explanation

It distributes leftover grid space.

Developer explanation

Use fr in grid layouts to create columns that share available space.

Syntax / pattern

grid-template-columns: 1fr 2fr;

Detailed example

.grid { display: grid; grid-template-columns: 1fr 2fr; }
Browser result / output:The second column receives twice the flexible space of the first.

Important values / related concepts

Value / conceptMeaning / usage
only forCSS Grid tracks
meaningfraction of available space

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with fr Unit where appropriate.

Official study links

❮ Previous Topic 65 of 295 Next ❯

auto Value

What it is

`auto` lets the browser calculate a value based on context.

Beginner explanation

It can center blocks, size grid/flex items, or use default layout behavior.

Developer explanation

Understand `auto` per property. `margin: auto` behaves differently from `width: auto` or `grid-auto-flow`.

Syntax / pattern

margin-inline: auto;

Detailed example

.container { max-width: 1200px; margin-inline: auto; }
Browser result / output:The container is centered horizontally when width is constrained.

Important values / related concepts

Value / conceptMeaning / usage
common usecentering, automatic sizing
depends onproperty context

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with auto Value where appropriate.

Official study links

❮ Previous Topic 66 of 295 Next ❯

inherit Value

What it is

`inherit` forces a property to take the parent value.

Beginner explanation

Use it when a property normally does not inherit but you want it to.

Developer explanation

Useful for form controls or pseudo-elements that should match parent font/color.

Syntax / pattern

property: inherit;

Detailed example

button { font: inherit; color: inherit; }
Browser result / output:The button uses the same font and color as its parent.

Important values / related concepts

Value / conceptMeaning / usage
purposeforce inheritance
common useform reset

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with inherit Value where appropriate.

Official study links

❮ Previous Topic 67 of 295 Next ❯

initial Value

What it is

`initial` resets a property to its initial CSS-defined value.

Beginner explanation

It ignores inherited or previous values and goes back to default for that property.

Developer explanation

Useful for resets but can be surprising because initial is not always browser default styles.

Syntax / pattern

property: initial;

Detailed example

.box { color: initial; }
Browser result / output:The text color returns to the property's initial value.

Important values / related concepts

Value / conceptMeaning / usage
resets toCSS initial value
not same asbrowser default stylesheet in every case

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with initial Value where appropriate.

Official study links

❮ Previous Topic 68 of 295 Next ❯

unset Value

What it is

`unset` acts like inherit for inherited properties and initial for non-inherited properties.

Beginner explanation

It removes a declaration in a context-aware way.

Developer explanation

Useful in resets and component overrides.

Syntax / pattern

property: unset;

Detailed example

.custom-link { all: unset; }
Browser result / output:The element loses many default styles.

Important values / related concepts

Value / conceptMeaning / usage
for inheritedinherit
for non-inheritedinitial

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with unset Value where appropriate.

Official study links

❮ Previous Topic 69 of 295 Next ❯

revert Value

What it is

`revert` rolls the value back to the previous cascade origin.

Beginner explanation

It can restore user-agent or user styles after author styles.

Developer explanation

Useful for safely undoing opinionated styling.

Syntax / pattern

property: revert;

Detailed example

.reset-button { all: revert; }
Browser result / output:The button returns closer to default browser styling.

Important values / related concepts

Value / conceptMeaning / usage
purposeundo author styling
use carefullycan reset many details

Real-time production scope

  • Use relative units for responsive layouts.
  • Use design tokens for consistent spacing.
  • Test zoom and mobile screen sizes.

Common mistakes and fixes

  • Mixing too many random units.
  • Using fixed px widths on mobile.
  • Not understanding what the unit is relative to.

Practice task

Practice: Create a card layout and replace fixed sizes with revert Value where appropriate.

Official study links

❮ Previous Topic 70 of 295 Next ❯

calc()

What it is

The `calc()` function performs calculations inside CSS values.

Beginner explanation

You can mix units such as `100% - 2rem`.

Developer explanation

Use calc for layout math where pure CSS can express the relationship. Avoid overcomplicated expressions that hide design intent.

Syntax / pattern

width: calc(100% - 2rem);

Detailed example

.panel { width: calc(100% - 2rem); margin-inline: 1rem; }
Browser result / output:The panel leaves 1rem space on both sides.

Important values / related concepts

Value / conceptMeaning / usage
supports+, -, *, / in modern CSS
common usefluid widths with fixed gaps

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using calc().

Official study links

❮ Previous Topic 71 of 295 Next ❯

min()

What it is

`min()` chooses the smallest value from a list.

Beginner explanation

Use it to cap a value so it never exceeds a limit.

Developer explanation

Useful for fluid sizing with maximum constraints.

Syntax / pattern

width: min(100%, 900px);

Detailed example

.container { width: min(100% - 2rem, 1200px); }
Browser result / output:The container is fluid but never wider than 1200px.

Important values / related concepts

Value / conceptMeaning / usage
purposechoose smallest
best forfluid containers

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using min().

Official study links

❮ Previous Topic 72 of 295 Next ❯

max()

What it is

`max()` chooses the largest value from a list.

Beginner explanation

Use it to enforce a minimum responsive value.

Developer explanation

Use carefully because it can force large sizes on small screens if misused.

Syntax / pattern

padding: max(1rem, 3vw);

Detailed example

.section { padding: max(1rem, 4vw); }
Browser result / output:Padding is at least 1rem and grows with viewport width.

Important values / related concepts

Value / conceptMeaning / usage
purposechoose largest
best forminimum spacing

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using max().

Official study links

❮ Previous Topic 73 of 295 Next ❯

clamp()

What it is

`clamp()` sets a minimum, preferred, and maximum value.

Beginner explanation

It is ideal for responsive typography.

Developer explanation

Use clamp for fluid type scales and spacing without many media queries.

Syntax / pattern

font-size: clamp(min, preferred, max);

Detailed example

.title { font-size: clamp(2rem, 5vw, 4rem); }
Browser result / output:The title grows with viewport width but never below 2rem or above 4rem.

Important values / related concepts

Value / conceptMeaning / usage
argumentsminimum, preferred, maximum
best forresponsive typography

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using clamp().

Official study links

❮ Previous Topic 74 of 295 Next ❯

var()

What it is

`var()` reads a CSS custom property value.

Beginner explanation

It lets you reuse values like colors, spacing, and fonts.

Developer explanation

Use variables as design tokens and component configuration hooks.

Syntax / pattern

color: var(--brand-color);

Detailed example

:root { --brand-color: #2563eb; }
.button { background: var(--brand-color); }
Browser result / output:The button background uses the root brand color.

Important values / related concepts

Value / conceptMeaning / usage
fallbackvar(--token, fallback)
common usethemes and design tokens

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using var().

Official study links

❮ Previous Topic 75 of 295 Next ❯

url()

What it is

`url()` references external resources such as images, fonts, or masks.

Beginner explanation

Use it in background images, font faces, cursor, and masks.

Developer explanation

Keep paths correct relative to the CSS file, not the HTML file.

Syntax / pattern

background-image: url('image.png');

Detailed example

.hero { background-image: url('../images/banner.jpg'); }
Browser result / output:The hero displays the referenced banner image.

Important values / related concepts

Value / conceptMeaning / usage
path baserelative to CSS file location
common usebackgrounds and fonts

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using url().

Official study links

❮ Previous Topic 76 of 295 Next ❯

attr()

What it is

`attr()` can read an HTML attribute in generated content and newer typed contexts in supported browsers.

Beginner explanation

Commonly used with `content` in pseudo-elements.

Developer explanation

Use carefully; do not rely on generated content for essential accessible text.

Syntax / pattern

content: attr(data-label);

Detailed example

.badge::after { content: attr(data-status); }
Browser result / output:The pseudo-element displays the value of `data-status`.

Important values / related concepts

Value / conceptMeaning / usage
common supportcontent property
cautionaccessibility

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using attr().

Official study links

❮ Previous Topic 77 of 295 Next ❯

linear-gradient()

What it is

`linear-gradient()` creates a color transition along a straight line.

Beginner explanation

Use it for hero backgrounds, buttons, overlays, and design effects.

Developer explanation

Gradients are images in CSS. Use enough contrast for text placed on top.

Syntax / pattern

background: linear-gradient(direction, color, color);

Detailed example

.hero { background: linear-gradient(135deg, #2563eb, #7c3aed); }
Browser result / output:The hero background blends blue into purple diagonally.

Important values / related concepts

Value / conceptMeaning / usage
directionto right, 135deg, etc.
usebackground-image/background

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using linear-gradient().

Official study links

❮ Previous Topic 78 of 295 Next ❯

radial-gradient()

What it is

`radial-gradient()` creates a gradient radiating from a center point.

Beginner explanation

Useful for glow effects and background decorations.

Developer explanation

Keep radial gradients subtle and avoid lowering text readability.

Syntax / pattern

background: radial-gradient(circle, color, color);

Detailed example

.glow { background: radial-gradient(circle at top, #bfdbfe, transparent 60%); }
Browser result / output:The element has a soft glow from the top.

Important values / related concepts

Value / conceptMeaning / usage
shapecircle or ellipse
positionat center/top/left etc.

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using radial-gradient().

Official study links

❮ Previous Topic 79 of 295 Next ❯

cubic-bezier()

What it is

`cubic-bezier()` defines custom animation timing.

Beginner explanation

It controls how a transition accelerates and slows down.

Developer explanation

Use it for polished UI interactions. Keep motion natural and respect reduced-motion preferences.

Syntax / pattern

transition-timing-function: cubic-bezier(...);

Detailed example

.button { transition: transform 200ms cubic-bezier(.2, .8, .2, 1); }
.button:hover { transform: translateY(-2px); }
Browser result / output:The button movement feels smooth and custom.

Important values / related concepts

Value / conceptMeaning / usage
common usetransitions and animations
debugDevTools easing editor

Real-time production scope

  • Use functions to reduce media queries and duplication.
  • Keep function expressions readable.
  • Combine with CSS variables for design systems.

Common mistakes and fixes

  • Overusing complex calculations.
  • Forgetting fallbacks for custom properties.
  • Using decorative generated content as essential content.

Practice task

Practice: Build a responsive card using cubic-bezier().

Official study links

❮ Previous Topic 80 of 295 Next ❯

color

What it is

Sets the foreground text color and can affect text decorations and currentColor.

Beginner explanation

Use it to control readable text color.

Developer explanation

From a developer point of view, `color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

color: value;

Detailed example

.card {
  color: #1f2937;
}
Browser result / output:The selected element renders with `color: #1f2937` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
namedred, blue
hex#2563eb
rgb/hslrgb(37 99 235), hsl(221 83% 53%)

Real-time production scope

  • Set body text color once and override only where needed.
  • Check contrast against background.

Common mistakes and fixes

  • Changing `color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 81 of 295 Next ❯

background-color

What it is

Sets the background color of an element.

Beginner explanation

Use it for sections, cards, buttons, alerts, and page backgrounds.

Developer explanation

From a developer point of view, `background-color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-color: value;

Detailed example

.card {
  background-color: #eff6ff;
}
Browser result / output:The selected element renders with `background-color: #eff6ff` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
transparentdefault in many cases
solid#fff, rgb(), hsl()
tokenvar(--surface)

Real-time production scope

  • Use design tokens for surfaces.
  • Do not rely on color alone to convey status.

Common mistakes and fixes

  • Changing `background-color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 82 of 295 Next ❯

opacity

What it is

Controls transparency of the entire element including children.

Beginner explanation

0 is invisible, 1 is fully visible.

Developer explanation

From a developer point of view, `opacity` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

opacity: value;

Detailed example

.card {
  opacity: 0.85;
}
Browser result / output:The selected element renders with `opacity: 0.85` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
0fully transparent
0.5half transparent
1fully opaque

Real-time production scope

  • Use for disabled UI carefully.
  • Prefer rgba/hsl alpha for only background transparency.

Common mistakes and fixes

  • Changing `opacity` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `opacity` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 83 of 295 Next ❯

currentColor

What it is

`currentColor` uses the current computed text color.

Beginner explanation

It lets borders, icons, and outlines match text color.

Developer explanation

From a developer point of view, `currentColor` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

currentColor: value;

Detailed example

.card {
  currentColor: currentColor;
}
Browser result / output:The selected element renders with `currentColor: currentColor` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
use withborder-color, fill, stroke, outline-color
benefittheme-friendly

Real-time production scope

  • Use for SVG icons and borders that should follow text color.

Common mistakes and fixes

  • Changing `currentColor` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `currentColor` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 84 of 295 Next ❯

accent-color

What it is

Sets the accent color for supported form controls like checkboxes, radio buttons, and range controls.

Beginner explanation

It gives native controls your brand color.

Developer explanation

From a developer point of view, `accent-color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

accent-color: value;

Detailed example

.card {
  accent-color: #2563eb;
}
Browser result / output:The selected element renders with `accent-color: #2563eb` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
applies tocheckbox, radio, range, progress
bestbrand-consistent forms

Real-time production scope

  • Use it for form branding while keeping native accessibility.

Common mistakes and fixes

  • Changing `accent-color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `accent-color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 85 of 295 Next ❯

Hex Colors

What it is

Hex colors use hexadecimal notation such as `#2563eb`.

Beginner explanation

They are compact and common in design systems.

Developer explanation

Developers often copy hex values from design tools. Use consistent token names rather than scattering raw hex everywhere.

Syntax / pattern

color: #2563eb;

Detailed example

.button { background-color: #2563eb; color: #ffffff; }
Browser result / output:The button has blue background and white text.

Important values / related concepts

Value / conceptMeaning / usage
#RGBshort form
#RRGGBBstandard
#RRGGBBAAwith alpha

Real-time production scope

  • Check contrast for body text and buttons.
  • Define colors as custom properties.
  • Test dark mode and high-contrast modes.

Common mistakes and fixes

  • Using low contrast text.
  • Using color alone for errors/success.
  • Copying random colors without a system.

Practice task

Practice: Create a success, warning, and error message with accessible hex colors choices.

Official study links

❮ Previous Topic 86 of 295 Next ❯

RGB and RGBA Colors

What it is

RGB defines red, green, blue channels; alpha adds transparency.

Beginner explanation

Use RGB when you want numeric color channels or alpha values.

Developer explanation

Modern CSS supports space-separated rgb with optional slash alpha.

Syntax / pattern

color: rgb(37 99 235 / 80%);

Detailed example

.overlay { background: rgb(15 23 42 / 70%); }
Browser result / output:The overlay is dark with 70% opacity.

Important values / related concepts

Value / conceptMeaning / usage
rgbred green blue
alphatransparency

Real-time production scope

  • Check contrast for body text and buttons.
  • Define colors as custom properties.
  • Test dark mode and high-contrast modes.

Common mistakes and fixes

  • Using low contrast text.
  • Using color alone for errors/success.
  • Copying random colors without a system.

Practice task

Practice: Create a success, warning, and error message with accessible rgb and rgba colors choices.

Official study links

❮ Previous Topic 87 of 295 Next ❯

HSL and HSLA Colors

What it is

HSL defines hue, saturation, and lightness; alpha adds transparency.

Beginner explanation

HSL is often easier for adjusting color brightness and saturation.

Developer explanation

Use HSL for themes where variants are derived from a base hue.

Syntax / pattern

color: hsl(221 83% 53%);

Detailed example

.link { color: hsl(221 83% 53%); }
.link:hover { color: hsl(221 83% 43%); }
Browser result / output:The hover link becomes a darker blue.

Important values / related concepts

Value / conceptMeaning / usage
hue0-360 degrees
saturationcolor intensity
lightnessbrightness

Real-time production scope

  • Check contrast for body text and buttons.
  • Define colors as custom properties.
  • Test dark mode and high-contrast modes.

Common mistakes and fixes

  • Using low contrast text.
  • Using color alone for errors/success.
  • Copying random colors without a system.

Practice task

Practice: Create a success, warning, and error message with accessible hsl and hsla colors choices.

Official study links

❮ Previous Topic 88 of 295 Next ❯

Color Contrast

What it is

Color contrast is the readability difference between foreground and background.

Beginner explanation

Text must be readable for users with low vision, glare, or small screens.

Developer explanation

Check contrast for normal text, large text, buttons, disabled states, and overlays. Use WCAG guidance in production.

Syntax / pattern

color + background-color

Detailed example

.alert { color: #7f1d1d; background: #fee2e2; }
Browser result / output:The alert has dark red text on light red background.

Important values / related concepts

Value / conceptMeaning / usage
high contrastbetter readability
testuse accessibility tools

Real-time production scope

  • Check contrast for body text and buttons.
  • Define colors as custom properties.
  • Test dark mode and high-contrast modes.

Common mistakes and fixes

  • Using low contrast text.
  • Using color alone for errors/success.
  • Copying random colors without a system.

Practice task

Practice: Create a success, warning, and error message with accessible color contrast choices.

Official study links

❮ Previous Topic 89 of 295 Next ❯

background

What it is

Shorthand for background color, image, position, size, repeat, origin, clip, and attachment.

Beginner explanation

Use it to set multiple background parts in one line.

Developer explanation

From a developer point of view, `background` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background: value;

Detailed example

.card {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}
Browser result / output:The selected element renders with `background: linear-gradient(135deg, #2563eb, #7c3aed)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
shorthandbackground combines multiple background properties
layerscomma-separated backgrounds

Real-time production scope

  • Use `background` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 90 of 295 Next ❯

background-image

What it is

Sets one or more background images.

Beginner explanation

Use for decorative images, gradients, and patterns.

Developer explanation

From a developer point of view, `background-image` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-image: value;

Detailed example

.card {
  background-image: url('banner.jpg');
}
Browser result / output:The selected element renders with `background-image: url('banner.jpg')` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
imageurl(...)
gradientlinear-gradient(...), radial-gradient(...)
noneno image

Real-time production scope

  • Use `background-image` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-image` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-image` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 91 of 295 Next ❯

background-size

What it is

Controls how background images are sized.

Beginner explanation

`cover` fills the area; `contain` fits entire image.

Developer explanation

From a developer point of view, `background-size` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-size: value;

Detailed example

.card {
  background-size: cover;
}
Browser result / output:The selected element renders with `background-size: cover` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
coverfills, may crop
containfits, may leave empty space
100% 100%stretches

Real-time production scope

  • Use `background-size` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-size` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-size` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 92 of 295 Next ❯

background-position

What it is

Controls where a background image is placed.

Beginner explanation

Use it to align hero images or patterns.

Developer explanation

From a developer point of view, `background-position` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-position: value;

Detailed example

.card {
  background-position: center;
}
Browser result / output:The selected element renders with `background-position: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
keywordscenter, top, bottom, left, right
lengths20px 40px
percent50% 50%

Real-time production scope

  • Use `background-position` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-position` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-position` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 93 of 295 Next ❯

background-repeat

What it is

Controls whether background images repeat.

Beginner explanation

Use no-repeat for photos, repeat for patterns.

Developer explanation

From a developer point of view, `background-repeat` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-repeat: value;

Detailed example

.card {
  background-repeat: no-repeat;
}
Browser result / output:The selected element renders with `background-repeat: no-repeat` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
repeattiles both directions
repeat-xhorizontal
repeat-yvertical
no-repeatsingle image

Real-time production scope

  • Use `background-repeat` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-repeat` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-repeat` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 94 of 295 Next ❯

background-attachment

What it is

Controls whether background scrolls with content or stays fixed.

Beginner explanation

Often used for parallax-like effects.

Developer explanation

From a developer point of view, `background-attachment` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-attachment: value;

Detailed example

.card {
  background-attachment: fixed;
}
Browser result / output:The selected element renders with `background-attachment: fixed` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
scrolldefault
fixedfixed to viewport
localscrolls with element content

Real-time production scope

  • Use `background-attachment` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-attachment` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-attachment` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 95 of 295 Next ❯

background-clip

What it is

Defines how far background painting extends.

Beginner explanation

Useful for clipping background to text or padding.

Developer explanation

From a developer point of view, `background-clip` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-clip: value;

Detailed example

.card {
  background-clip: padding-box;
}
Browser result / output:The selected element renders with `background-clip: padding-box` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
border-boxunder border
padding-boxinside border
content-boxcontent only
textclip to text in supported contexts

Real-time production scope

  • Use `background-clip` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-clip` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-clip` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 96 of 295 Next ❯

background-origin

What it is

Defines the positioning area for background images.

Beginner explanation

Controls where background-position starts.

Developer explanation

From a developer point of view, `background-origin` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-origin: value;

Detailed example

.card {
  background-origin: content-box;
}
Browser result / output:The selected element renders with `background-origin: content-box` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
border-boxfrom border edge
padding-boxfrom padding edge
content-boxfrom content edge

Real-time production scope

  • Use `background-origin` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-origin` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-origin` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 97 of 295 Next ❯

background-blend-mode

What it is

Blends multiple backgrounds or background with color.

Beginner explanation

Use it for image overlays and visual effects.

Developer explanation

From a developer point of view, `background-blend-mode` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

background-blend-mode: value;

Detailed example

.card {
  background-blend-mode: multiply;
}
Browser result / output:The selected element renders with `background-blend-mode: multiply` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normalno blend
multiplydarkens
screenlightens
overlaycontrast effect

Real-time production scope

  • Use `background-blend-mode` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `background-blend-mode` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `background-blend-mode` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 98 of 295 Next ❯

box-sizing

What it is

Controls how width and height are calculated.

Beginner explanation

`border-box` includes padding and border inside width/height.

Developer explanation

From a developer point of view, `box-sizing` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

box-sizing: value;

Detailed example

.card {
  box-sizing: border-box;
}
Browser result / output:The selected element renders with `box-sizing: border-box` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
content-boxdefault, width excludes padding/border
border-boxwidth includes padding/border

Real-time production scope

  • Set `* { box-sizing: border-box; }` in most projects.

Common mistakes and fixes

  • Changing `box-sizing` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `box-sizing` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 99 of 295 Next ❯

width

What it is

Sets the content width of an element.

Beginner explanation

Controls horizontal size.

Developer explanation

From a developer point of view, `width` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

width: value;

Detailed example

.card {
  width: 320px;
}
Browser result / output:The selected element renders with `width: 320px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autobrowser calculates
px/rem/%fixed or fluid
fit-contentshrink to content limit

Real-time production scope

  • Avoid fixed widths for full page layouts on mobile.

Common mistakes and fixes

  • Changing `width` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `width` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 100 of 295 Next ❯

height

What it is

Sets the content height of an element.

Beginner explanation

Controls vertical size.

Developer explanation

From a developer point of view, `height` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

height: value;

Detailed example

.card {
  height: 200px;
}
Browser result / output:The selected element renders with `height: 200px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autoheight based on content
px/rem/vhfixed or viewport-based

Real-time production scope

  • Prefer min-height for flexible content.

Common mistakes and fixes

  • Changing `height` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `height` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 101 of 295 Next ❯

min-width

What it is

Sets the minimum width an element can shrink to.

Beginner explanation

Prevents an element from becoming too narrow.

Developer explanation

From a developer point of view, `min-width` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

min-width: value;

Detailed example

.card {
  min-width: 240px;
}
Browser result / output:The selected element renders with `min-width: 240px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
percentagerelative to parent
0allow flex/grid items to shrink

Real-time production scope

  • Use `min-width: 0` to fix flex/grid text overflow.

Common mistakes and fixes

  • Changing `min-width` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `min-width` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 102 of 295 Next ❯

max-width

What it is

Sets the maximum width an element can grow to.

Beginner explanation

Keeps content readable on large screens.

Developer explanation

From a developer point of view, `max-width` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

max-width: value;

Detailed example

.card {
  max-width: 1200px;
}
Browser result / output:The selected element renders with `max-width: 1200px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
nonedefault
lengthfixed max
100%do not exceed parent

Real-time production scope

  • Use with `margin-inline: auto` for centered containers.

Common mistakes and fixes

  • Changing `max-width` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `max-width` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 103 of 295 Next ❯

min-height

What it is

Sets the minimum height.

Beginner explanation

Allows content to grow while ensuring a minimum visual area.

Developer explanation

From a developer point of view, `min-height` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

min-height: value;

Detailed example

.card {
  min-height: 100dvh;
}
Browser result / output:The selected element renders with `min-height: 100dvh` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
viewportvh/dvh
autodefault

Real-time production scope

  • Use for full-page sections and cards that must align.

Common mistakes and fixes

  • Changing `min-height` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `min-height` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 104 of 295 Next ❯

max-height

What it is

Sets the maximum height.

Beginner explanation

Can create scrollable panels when combined with overflow.

Developer explanation

From a developer point of view, `max-height` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

max-height: value;

Detailed example

.card {
  max-height: 400px;
}
Browser result / output:The selected element renders with `max-height: 400px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
nonedefault
lengthfixed maximum
percentagedepends on parent height

Real-time production scope

  • Use with `overflow: auto` for modals/menus.

Common mistakes and fixes

  • Changing `max-height` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `max-height` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 105 of 295 Next ❯

margin

What it is

Creates space outside an element.

Beginner explanation

Margin pushes elements away from each other.

Developer explanation

From a developer point of view, `margin` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin: value;

Detailed example

.card {
  margin: 1rem;
}
Browser result / output:The selected element renders with `margin: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
singleall sides
two valuesvertical horizontal
four valuestop right bottom left
autoautomatic spacing

Real-time production scope

  • Use margin for spacing between components.

Common mistakes and fixes

  • Changing `margin` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 106 of 295 Next ❯

margin-top

What it is

Sets space above an element.

Beginner explanation

Use it to separate from previous content.

Developer explanation

From a developer point of view, `margin-top` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-top: value;

Detailed example

.card {
  margin-top: 1rem;
}
Browser result / output:The selected element renders with `margin-top: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
percentagerelative to width in many cases
autocontext-specific

Real-time production scope

  • Prefer consistent vertical rhythm utilities.

Common mistakes and fixes

  • Changing `margin-top` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-top` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 107 of 295 Next ❯

margin-right

What it is

Sets space to the right of an element.

Beginner explanation

Useful in inline/flex layouts, but gap is often better.

Developer explanation

From a developer point of view, `margin-right` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-right: value;

Detailed example

.card {
  margin-right: 1rem;
}
Browser result / output:The selected element renders with `margin-right: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
autocan push flex items

Real-time production scope

  • Use logical `margin-inline-end` for international layouts.

Common mistakes and fixes

  • Changing `margin-right` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-right` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 108 of 295 Next ❯

margin-bottom

What it is

Sets space below an element.

Beginner explanation

Common for text and card spacing.

Developer explanation

From a developer point of view, `margin-bottom` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-bottom: value;

Detailed example

.card {
  margin-bottom: 1rem;
}
Browser result / output:The selected element renders with `margin-bottom: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
0remove extra spacing

Real-time production scope

  • Use margin-bottom consistently for readable content flow.

Common mistakes and fixes

  • Changing `margin-bottom` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-bottom` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 109 of 295 Next ❯

margin-left

What it is

Sets space to the left of an element.

Beginner explanation

Often used for indentation or auto-centering.

Developer explanation

From a developer point of view, `margin-left` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-left: value;

Detailed example

.card {
  margin-left: auto;
}
Browser result / output:The selected element renders with `margin-left: auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autocan push/center
lengthpx/rem

Real-time production scope

  • Use logical `margin-inline-start` for RTL-friendly layouts.

Common mistakes and fixes

  • Changing `margin-left` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-left` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 110 of 295 Next ❯

margin-inline

What it is

Sets logical left/right margins based on writing mode.

Beginner explanation

Use it instead of margin-left/right for better internationalization.

Developer explanation

From a developer point of view, `margin-inline` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-inline: value;

Detailed example

.card {
  margin-inline: auto;
}
Browser result / output:The selected element renders with `margin-inline: auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autocenter block with width
lengthboth inline sides

Real-time production scope

  • Use for centered containers: `margin-inline: auto`.

Common mistakes and fixes

  • Changing `margin-inline` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-inline` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 111 of 295 Next ❯

margin-block

What it is

Sets logical top/bottom margins.

Beginner explanation

Useful for vertical spacing that respects writing mode.

Developer explanation

From a developer point of view, `margin-block` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

margin-block: value;

Detailed example

.card {
  margin-block: 1rem;
}
Browser result / output:The selected element renders with `margin-block: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueboth block sides
two valuesstart and end

Real-time production scope

  • Good for component vertical spacing.

Common mistakes and fixes

  • Changing `margin-block` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `margin-block` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 112 of 295 Next ❯

padding

What it is

Creates space inside an element between content and border.

Beginner explanation

Padding gives content breathing room.

Developer explanation

From a developer point of view, `padding` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

padding: value;

Detailed example

.card {
  padding: 1rem;
}
Browser result / output:The selected element renders with `padding: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
singleall sides
two valuesvertical horizontal
four valuestop right bottom left

Real-time production scope

  • Use padding inside cards, buttons, sections.

Common mistakes and fixes

  • Changing `padding` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `padding` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 113 of 295 Next ❯

padding-inline

What it is

Sets logical left/right padding.

Beginner explanation

Better than left/right for multilingual layouts.

Developer explanation

From a developer point of view, `padding-inline` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

padding-inline: value;

Detailed example

.card {
  padding-inline: 1rem;
}
Browser result / output:The selected element renders with `padding-inline: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueboth inline sides
two valuesstart/end

Real-time production scope

  • Use for buttons and containers.

Common mistakes and fixes

  • Changing `padding-inline` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `padding-inline` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 114 of 295 Next ❯

padding-block

What it is

Sets logical top/bottom padding.

Beginner explanation

Useful for vertical button/section spacing.

Developer explanation

From a developer point of view, `padding-block` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

padding-block: value;

Detailed example

.card {
  padding-block: 0.75rem;
}
Browser result / output:The selected element renders with `padding-block: 0.75rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueboth block sides
two valuesstart/end

Real-time production scope

  • Use for buttons and sections.

Common mistakes and fixes

  • Changing `padding-block` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `padding-block` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 115 of 295 Next ❯

border

What it is

Draws a border around an element.

Beginner explanation

A border has width, style, and color.

Developer explanation

From a developer point of view, `border` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border: value;

Detailed example

.card {
  border: 1px solid #e5e7eb;
}
Browser result / output:The selected element renders with `border: 1px solid #e5e7eb` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
width1px
stylesolid/dashed/dotted
color#ddd/currentColor

Real-time production scope

  • Use borders for separation without heavy shadows.

Common mistakes and fixes

  • Changing `border` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 116 of 295 Next ❯

border-width

What it is

Sets border thickness.

Beginner explanation

Can be one value or per side.

Developer explanation

From a developer point of view, `border-width` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-width: value;

Detailed example

.card {
  border-width: 2px;
}
Browser result / output:The selected element renders with `border-width: 2px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
thin/medium/thickkeywords
lengthpx/rem

Real-time production scope

  • Keep border widths consistent in design tokens.

Common mistakes and fixes

  • Changing `border-width` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-width` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 117 of 295 Next ❯

border-style

What it is

Sets border line style.

Beginner explanation

A border does not appear unless style is not none.

Developer explanation

From a developer point of view, `border-style` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-style: value;

Detailed example

.card {
  border-style: solid;
}
Browser result / output:The selected element renders with `border-style: solid` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
solidnormal line
dasheddashes
dotteddots
noneno border

Real-time production scope

  • Use dashed border for upload/drop zones.

Common mistakes and fixes

  • Changing `border-style` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-style` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 118 of 295 Next ❯

border-color

What it is

Sets border color.

Beginner explanation

Use it with currentColor or design tokens.

Developer explanation

From a developer point of view, `border-color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-color: value;

Detailed example

.card {
  border-color: #d1d5db;
}
Browser result / output:The selected element renders with `border-color: #d1d5db` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
colorany CSS color
currentColormatch text

Real-time production scope

  • Use high enough contrast for focused controls.

Common mistakes and fixes

  • Changing `border-color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 119 of 295 Next ❯

border-radius

What it is

Rounds element corners.

Beginner explanation

Use it for cards, buttons, inputs, avatars.

Developer explanation

From a developer point of view, `border-radius` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-radius: value;

Detailed example

.card {
  border-radius: 12px;
}
Browser result / output:The selected element renders with `border-radius: 12px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
percent50% for circles/avatars
per cornerfour values

Real-time production scope

  • Use consistent radius scale.

Common mistakes and fixes

  • Changing `border-radius` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-radius` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 120 of 295 Next ❯

outline

What it is

Draws a line outside the border and does not affect layout.

Beginner explanation

Important for focus indicators.

Developer explanation

From a developer point of view, `outline` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

outline: value;

Detailed example

.card {
  outline: 3px solid #93c5fd;
}
Browser result / output:The selected element renders with `outline: 3px solid #93c5fd` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
stylesolid/auto
offsetuse outline-offset
coloraccessible contrast

Real-time production scope

  • Never remove focus outline without replacement.

Common mistakes and fixes

  • Changing `outline` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `outline` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 121 of 295 Next ❯

outline-offset

What it is

Adds space between outline and border.

Beginner explanation

Makes focus rings clearer.

Developer explanation

From a developer point of view, `outline-offset` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

outline-offset: value;

Detailed example

.card {
  outline-offset: 3px;
}
Browser result / output:The selected element renders with `outline-offset: 3px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
positiveaway from element
negativeinside

Real-time production scope

  • Use with focus-visible styles.

Common mistakes and fixes

  • Changing `outline-offset` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `outline-offset` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 122 of 295 Next ❯

box-shadow

What it is

Adds shadow effects around an element.

Beginner explanation

Use shadows for elevation and visual separation.

Developer explanation

From a developer point of view, `box-shadow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

box-shadow: value;

Detailed example

.card {
  box-shadow: 0 10px 25px rgb(0 0 0 / 10%);
}
Browser result / output:The selected element renders with `box-shadow: 0 10px 25px rgb(0 0 0 / 10%)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
offset-xhorizontal offset
offset-yvertical offset
blursoftness
spreadsize
insetinside shadow

Real-time production scope

  • Use subtle shadows; avoid heavy low-performance effects.

Common mistakes and fixes

  • Changing `box-shadow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `box-shadow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 123 of 295 Next ❯

aspect-ratio

What it is

Sets preferred width-to-height ratio.

Beginner explanation

Useful for cards, videos, images, placeholders.

Developer explanation

From a developer point of view, `aspect-ratio` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

aspect-ratio: value;

Detailed example

.card {
  aspect-ratio: 16 / 9;
}
Browser result / output:The selected element renders with `aspect-ratio: 16 / 9` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
ratio1 / 1, 16 / 9, 4 / 3
works withauto sizes

Real-time production scope

  • Use for image/video containers to prevent layout shift.

Common mistakes and fixes

  • Changing `aspect-ratio` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `aspect-ratio` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 124 of 295 Next ❯

font-family

What it is

Chooses the font used for text.

Beginner explanation

Use a font stack so fallback fonts work.

Developer explanation

From a developer point of view, `font-family` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

font-family: value;

Detailed example

.card {
  font-family: 'Segoe UI', Arial, sans-serif;
}
Browser result / output:The selected element renders with `font-family: 'Segoe UI', Arial, sans-serif` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
genericserif, sans-serif, monospace
customloaded with @font-face or external service

Real-time production scope

  • Use `font-family` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `font-family` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `font-family` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 125 of 295 Next ❯

font-size

What it is

Controls text size.

Beginner explanation

Use rem/clamp for scalable typography.

Developer explanation

From a developer point of view, `font-size` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

font-size: value;

Detailed example

.card {
  font-size: 1rem;
}
Browser result / output:The selected element renders with `font-size: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
absolutepx
relativerem/em
fluidclamp(...)

Real-time production scope

  • Use `font-size` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `font-size` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `font-size` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 126 of 295 Next ❯

font-weight

What it is

Controls font thickness.

Beginner explanation

400 normal, 700 bold.

Developer explanation

From a developer point of view, `font-weight` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

font-weight: value;

Detailed example

.card {
  font-weight: 700;
}
Browser result / output:The selected element renders with `font-weight: 700` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normal400
bold700
numeric100-900 if font supports

Real-time production scope

  • Use `font-weight` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `font-weight` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `font-weight` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 127 of 295 Next ❯

font-style

What it is

Controls italic or normal text style.

Beginner explanation

Use italic for emphasis or editorial design.

Developer explanation

From a developer point of view, `font-style` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

font-style: value;

Detailed example

.card {
  font-style: italic;
}
Browser result / output:The selected element renders with `font-style: italic` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normaldefault
italicitalic style
obliqueslanted style

Real-time production scope

  • Use `font-style` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `font-style` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `font-style` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 128 of 295 Next ❯

line-height

What it is

Controls space between lines of text.

Beginner explanation

Improves readability.

Developer explanation

From a developer point of view, `line-height` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

line-height: value;

Detailed example

.card {
  line-height: 1.6;
}
Browser result / output:The selected element renders with `line-height: 1.6` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
unitlessrecommended for body text
lengthfixed
percentagerelative

Real-time production scope

  • Use `line-height` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `line-height` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `line-height` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 129 of 295 Next ❯

letter-spacing

What it is

Controls space between characters.

Beginner explanation

Use small values for uppercase labels or headings.

Developer explanation

From a developer point of view, `letter-spacing` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

letter-spacing: value;

Detailed example

.card {
  letter-spacing: 0.04em;
}
Browser result / output:The selected element renders with `letter-spacing: 0.04em` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
positivemore space
negativetighter text

Real-time production scope

  • Use `letter-spacing` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `letter-spacing` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `letter-spacing` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 130 of 295 Next ❯

word-spacing

What it is

Controls space between words.

Beginner explanation

Use sparingly.

Developer explanation

From a developer point of view, `word-spacing` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

word-spacing: value;

Detailed example

.card {
  word-spacing: 0.1em;
}
Browser result / output:The selected element renders with `word-spacing: 0.1em` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normaldefault
lengthextra spacing

Real-time production scope

  • Use `word-spacing` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `word-spacing` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `word-spacing` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 131 of 295 Next ❯

text-align

What it is

Aligns inline content horizontally.

Beginner explanation

Use left/start for body text and center for short headings.

Developer explanation

From a developer point of view, `text-align` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-align: value;

Detailed example

.card {
  text-align: center;
}
Browser result / output:The selected element renders with `text-align: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
start/endlogical
left/rightphysical
centercentered
justifyspread lines

Real-time production scope

  • Use `text-align` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-align` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-align` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 132 of 295 Next ❯

text-decoration

What it is

Adds lines to text.

Beginner explanation

Common for links, deleted text, and emphasis.

Developer explanation

From a developer point of view, `text-decoration` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-decoration: value;

Detailed example

.card {
  text-decoration: underline;
}
Browser result / output:The selected element renders with `text-decoration: underline` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
underlineline below
line-throughdeleted
noneremove

Real-time production scope

  • Use `text-decoration` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-decoration` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-decoration` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 133 of 295 Next ❯

text-decoration-color

What it is

Sets decoration line color.

Beginner explanation

Useful for branded underlines.

Developer explanation

From a developer point of view, `text-decoration-color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-decoration-color: value;

Detailed example

.card {
  text-decoration-color: #2563eb;
}
Browser result / output:The selected element renders with `text-decoration-color: #2563eb` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
colorany CSS color
currentColormatches text

Real-time production scope

  • Use `text-decoration-color` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-decoration-color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-decoration-color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 134 of 295 Next ❯

text-decoration-thickness

What it is

Controls underline/line thickness.

Beginner explanation

Useful for better link styling.

Developer explanation

From a developer point of view, `text-decoration-thickness` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-decoration-thickness: value;

Detailed example

.card {
  text-decoration-thickness: 2px;
}
Browser result / output:The selected element renders with `text-decoration-thickness: 2px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autodefault
from-fontfont-defined
lengthfixed

Real-time production scope

  • Use `text-decoration-thickness` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-decoration-thickness` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-decoration-thickness` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 135 of 295 Next ❯

text-underline-offset

What it is

Moves underline away from text.

Beginner explanation

Improves readability of links.

Developer explanation

From a developer point of view, `text-underline-offset` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-underline-offset: value;

Detailed example

.card {
  text-underline-offset: 0.2em;
}
Browser result / output:The selected element renders with `text-underline-offset: 0.2em` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/em/rem
autobrowser default

Real-time production scope

  • Use `text-underline-offset` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-underline-offset` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-underline-offset` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 136 of 295 Next ❯

text-transform

What it is

Changes text capitalization visually.

Beginner explanation

Use for labels but keep source text readable.

Developer explanation

From a developer point of view, `text-transform` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-transform: value;

Detailed example

.card {
  text-transform: uppercase;
}
Browser result / output:The selected element renders with `text-transform: uppercase` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
uppercaseALL CAPS
lowercaselowercase
capitalizeEach Word

Real-time production scope

  • Use `text-transform` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-transform` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-transform` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 137 of 295 Next ❯

text-indent

What it is

Indents first line of a text block.

Beginner explanation

Used in articles or print-like layouts.

Developer explanation

From a developer point of view, `text-indent` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-indent: value;

Detailed example

.card {
  text-indent: 2em;
}
Browser result / output:The selected element renders with `text-indent: 2em` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/em
percentagerelative to width

Real-time production scope

  • Use `text-indent` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-indent` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-indent` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 138 of 295 Next ❯

text-shadow

What it is

Adds shadow behind text.

Beginner explanation

Use carefully to avoid blurry unreadable text.

Developer explanation

From a developer point of view, `text-shadow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-shadow: value;

Detailed example

.card {
  text-shadow: 0 2px 4px rgb(0 0 0 / 30%);
}
Browser result / output:The selected element renders with `text-shadow: 0 2px 4px rgb(0 0 0 / 30%)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
offsetx/y
blursoftness
colorshadow color

Real-time production scope

  • Use `text-shadow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-shadow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-shadow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 139 of 295 Next ❯

white-space

What it is

Controls how spaces and line breaks are handled.

Beginner explanation

Useful for code, labels, and truncation.

Developer explanation

From a developer point of view, `white-space` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

white-space: value;

Detailed example

.card {
  white-space: nowrap;
}
Browser result / output:The selected element renders with `white-space: nowrap` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normalcollapse spaces
nowrapsingle line
prepreserve
pre-wrappreserve and wrap

Real-time production scope

  • Use `white-space` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `white-space` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `white-space` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 140 of 295 Next ❯

overflow-wrap

What it is

Controls if long words can break to avoid overflow.

Beginner explanation

Useful for URLs and long IDs.

Developer explanation

From a developer point of view, `overflow-wrap` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

overflow-wrap: value;

Detailed example

.card {
  overflow-wrap: break-word;
}
Browser result / output:The selected element renders with `overflow-wrap: break-word` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normaldo not break words
break-wordbreak long words
anywheremore aggressive

Real-time production scope

  • Use `overflow-wrap` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `overflow-wrap` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `overflow-wrap` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 141 of 295 Next ❯

word-break

What it is

Controls word-breaking behavior.

Beginner explanation

Useful for languages or long strings but can hurt readability.

Developer explanation

From a developer point of view, `word-break` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

word-break: value;

Detailed example

.card {
  word-break: break-word;
}
Browser result / output:The selected element renders with `word-break: break-word` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normaldefault
break-allbreak any character
keep-allCJK behavior

Real-time production scope

  • Use `word-break` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `word-break` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `word-break` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 142 of 295 Next ❯

text-overflow

What it is

Controls clipped inline overflow indicator.

Beginner explanation

Usually used with nowrap and overflow hidden.

Developer explanation

From a developer point of view, `text-overflow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

text-overflow: value;

Detailed example

.card {
  text-overflow: ellipsis;
}
Browser result / output:The selected element renders with `text-overflow: ellipsis` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
clipcut off
ellipsisshow ...

Real-time production scope

  • Use `text-overflow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `text-overflow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `text-overflow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 143 of 295 Next ❯

direction

What it is

Sets text direction.

Beginner explanation

Use for RTL/LTR content, usually with HTML dir attribute.

Developer explanation

From a developer point of view, `direction` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

direction: value;

Detailed example

.card {
  direction: rtl;
}
Browser result / output:The selected element renders with `direction: rtl` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
ltrleft-to-right
rtlright-to-left

Real-time production scope

  • Use `direction` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `direction` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `direction` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 144 of 295 Next ❯

writing-mode

What it is

Controls horizontal/vertical text flow.

Beginner explanation

Useful for vertical labels or multilingual layouts.

Developer explanation

From a developer point of view, `writing-mode` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

writing-mode: value;

Detailed example

.card {
  writing-mode: vertical-rl;
}
Browser result / output:The selected element renders with `writing-mode: vertical-rl` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
horizontal-tbnormal
vertical-rlvertical right-left
vertical-lrvertical left-right

Real-time production scope

  • Use `writing-mode` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `writing-mode` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `writing-mode` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 145 of 295 Next ❯

@font-face

What it is

Defines a custom downloadable font.

Beginner explanation

Use it to host and load your own fonts.

Developer explanation

Font loading affects performance and perceived quality. Use WOFF2, limit font weights, and set `font-display: swap` when appropriate.

Syntax / pattern

@font-face { font-family: name; src: url(...); }

Detailed example

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

body {
  font-family: "Inter", system-ui, sans-serif;
}
Browser result / output:The browser loads Inter if available and falls back to system fonts while loading.

Important values / related concepts

Value / conceptMeaning / usage
font-familycustom name
srcfont file
font-displayloading behavior

Real-time production scope

  • Use WOFF2 fonts.
  • Load only needed weights/styles.
  • Use `font-display` to reduce invisible text.

Common mistakes and fixes

  • Loading too many font files.
  • Using custom fonts without fallbacks.
  • Ignoring performance impact.

Practice task

Practice: Add a custom font using @font-face and apply it to body.

Official study links

❮ Previous Topic 146 of 295 Next ❯

display

What it is

Controls how an element participates in layout.

Beginner explanation

It can make elements block, inline, flex, grid, or hidden.

Developer explanation

From a developer point of view, `display` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

display: value;

Detailed example

.card {
  display: flex;
}
Browser result / output:The selected element renders with `display: flex` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
blocknew line, full width
inlinewithin line
inline-blockinline but sizeable
flexflex layout
gridgrid layout
noneremoved from layout

Real-time production scope

  • Use `display` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `display` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `display` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 147 of 295 Next ❯

visibility

What it is

Controls whether an element is visible while preserving layout space.

Beginner explanation

Hidden elements are invisible but still take space.

Developer explanation

From a developer point of view, `visibility` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

visibility: value;

Detailed example

.card {
  visibility: hidden;
}
Browser result / output:The selected element renders with `visibility: hidden` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
visibleshown
hiddeninvisible but space remains
collapsetable-related behavior

Real-time production scope

  • Use `visibility` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `visibility` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `visibility` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 148 of 295 Next ❯

position

What it is

Controls how an element is positioned.

Beginner explanation

Static is default; relative/absolute/fixed/sticky enable offsets.

Developer explanation

From a developer point of view, `position` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

position: value;

Detailed example

.card {
  position: relative;
}
Browser result / output:The selected element renders with `position: relative` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
staticnormal flow
relativeoffset from own position
absolutepositioned to ancestor
fixedviewport
stickysticks while scrolling

Real-time production scope

  • Use `position` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `position` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `position` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 149 of 295 Next ❯

top

What it is

Sets top offset for positioned elements.

Beginner explanation

Works when position is not static.

Developer explanation

From a developer point of view, `top` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

top: value;

Detailed example

.card {
  top: 0;
}
Browser result / output:The selected element renders with `top: 0` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
percentagerelative to containing block
autodefault

Real-time production scope

  • Use `top` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `top` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `top` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 150 of 295 Next ❯

right

What it is

Sets right offset for positioned elements.

Beginner explanation

Used for badges, modals, fixed buttons.

Developer explanation

From a developer point of view, `right` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

right: value;

Detailed example

.card {
  right: 1rem;
}
Browser result / output:The selected element renders with `right: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
autodefault

Real-time production scope

  • Use `right` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `right` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `right` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 151 of 295 Next ❯

bottom

What it is

Sets bottom offset for positioned elements.

Beginner explanation

Used for footers, floating chat buttons, sticky bars.

Developer explanation

From a developer point of view, `bottom` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

bottom: value;

Detailed example

.card {
  bottom: 1rem;
}
Browser result / output:The selected element renders with `bottom: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
autodefault

Real-time production scope

  • Use `bottom` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `bottom` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `bottom` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 152 of 295 Next ❯

left

What it is

Sets left offset for positioned elements.

Beginner explanation

Used for absolute positioning and overlays.

Developer explanation

From a developer point of view, `left` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

left: value;

Detailed example

.card {
  left: 0;
}
Browser result / output:The selected element renders with `left: 0` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
autodefault

Real-time production scope

  • Use `left` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `left` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `left` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 153 of 295 Next ❯

inset

What it is

Shorthand for top/right/bottom/left.

Beginner explanation

Useful for overlays that fill a parent.

Developer explanation

From a developer point of view, `inset` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

inset: value;

Detailed example

.card {
  inset: 0;
}
Browser result / output:The selected element renders with `inset: 0` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueall sides
two/four valueslike margin

Real-time production scope

  • Use `inset` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `inset` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `inset` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 154 of 295 Next ❯

z-index

What it is

Controls stacking order of positioned/flex/grid elements.

Beginner explanation

Higher z-index appears above lower z-index within stacking context.

Developer explanation

From a developer point of view, `z-index` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

z-index: value;

Detailed example

.card {
  z-index: 10;
}
Browser result / output:The selected element renders with `z-index: 10` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autodefault
integerstacking level
contextonly within stacking context

Real-time production scope

  • Use `z-index` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `z-index` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `z-index` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 155 of 295 Next ❯

overflow

What it is

Controls content that does not fit its box.

Beginner explanation

Use auto for scrollable panels.

Developer explanation

From a developer point of view, `overflow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

overflow: value;

Detailed example

.card {
  overflow: auto;
}
Browser result / output:The selected element renders with `overflow: auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
visibledefault
hiddenclip
autoscroll if needed
scrollalways scrollbars

Real-time production scope

  • Use `overflow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `overflow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `overflow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 156 of 295 Next ❯

overflow-x

What it is

Controls horizontal overflow.

Beginner explanation

Useful for tables or code blocks.

Developer explanation

From a developer point of view, `overflow-x` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

overflow-x: value;

Detailed example

.card {
  overflow-x: auto;
}
Browser result / output:The selected element renders with `overflow-x: auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
hiddenclip horizontal
autohorizontal scroll if needed

Real-time production scope

  • Use `overflow-x` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `overflow-x` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `overflow-x` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 157 of 295 Next ❯

overflow-y

What it is

Controls vertical overflow.

Beginner explanation

Useful for modals, dropdowns, sidebars.

Developer explanation

From a developer point of view, `overflow-y` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

overflow-y: value;

Detailed example

.card {
  overflow-y: auto;
}
Browser result / output:The selected element renders with `overflow-y: auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
hiddenclip vertical
autovertical scroll if needed

Real-time production scope

  • Use `overflow-y` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `overflow-y` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `overflow-y` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 158 of 295 Next ❯

float

What it is

Moves an element to left/right allowing text wrap.

Beginner explanation

Older layout method; mostly use for text-wrapped images now.

Developer explanation

From a developer point of view, `float` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

float: value;

Detailed example

.card {
  float: left;
}
Browser result / output:The selected element renders with `float: left` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
leftfloat left
rightfloat right
nonedefault

Real-time production scope

  • Use `float` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `float` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `float` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 159 of 295 Next ❯

clear

What it is

Controls whether an element can sit beside floated elements.

Beginner explanation

Useful after floats.

Developer explanation

From a developer point of view, `clear` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

clear: value;

Detailed example

.card {
  clear: both;
}
Browser result / output:The selected element renders with `clear: both` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
leftclear left floats
rightclear right floats
bothclear both

Real-time production scope

  • Use `clear` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `clear` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `clear` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 160 of 295 Next ❯

object-fit

What it is

Controls how replaced content like images/videos fit a box.

Beginner explanation

Use cover for image cards and contain for full image visibility.

Developer explanation

From a developer point of view, `object-fit` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

object-fit: value;

Detailed example

.card {
  object-fit: cover;
}
Browser result / output:The selected element renders with `object-fit: cover` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
fillstretch
containfit all
coverfill and crop
noneoriginal size
scale-downsmaller of none/contain

Real-time production scope

  • Use `object-fit` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `object-fit` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `object-fit` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 161 of 295 Next ❯

object-position

What it is

Controls alignment of image/video inside its box.

Beginner explanation

Use it to choose crop focus.

Developer explanation

From a developer point of view, `object-position` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

object-position: value;

Detailed example

.card {
  object-position: center;
}
Browser result / output:The selected element renders with `object-position: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
keywordscenter top
percent50% 50%
length10px 20px

Real-time production scope

  • Use `object-position` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `object-position` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `object-position` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 162 of 295 Next ❯

isolation

What it is

Controls stacking context isolation.

Beginner explanation

Useful when blending/z-index effects should not affect outside elements.

Developer explanation

From a developer point of view, `isolation` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

isolation: value;

Detailed example

.card {
  isolation: isolate;
}
Browser result / output:The selected element renders with `isolation: isolate` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autodefault
isolatecreates new stacking context

Real-time production scope

  • Use `isolation` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `isolation` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `isolation` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 163 of 295 Next ❯

contain

What it is

Tells the browser an element is independent in layout/paint/style/size ways.

Beginner explanation

Can improve performance for isolated components.

Developer explanation

From a developer point of view, `contain` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

contain: value;

Detailed example

.card {
  contain: layout paint;
}
Browser result / output:The selected element renders with `contain: layout paint` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
layoutlayout containment
paintpaint containment
sizesize containment
contentcommon combination

Real-time production scope

  • Use `contain` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `contain` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `contain` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 164 of 295 Next ❯

display: flex

What it is

Turns an element into a flex container.

Beginner explanation

Its direct children become flex items.

Developer explanation

Flexbox is one-dimensional layout: it is best for arranging items in a row or column, such as navbars, toolbars, cards, and form actions.

Syntax / pattern

display: flex;

Detailed example

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
Browser result / output:Navbar children align in one row with spacing and vertical centering.

Important values / related concepts

Value / conceptMeaning / usage
containerparent with display:flex
itemsdirect children

Real-time production scope

  • Use flexbox for navbars, button rows, simple card rows, vertical centering.
  • Use grid for two-dimensional page layouts.

Common mistakes and fixes

  • Using flexbox for complex two-dimensional grids.
  • Forgetting only direct children are flex items.
  • Not setting `min-width: 0` when text overflows.

Practice task

Practice: Build a navbar with logo left and links right using display:flex.

Official study links

❮ Previous Topic 165 of 295 Next ❯

flex-direction

What it is

Sets the main axis direction.

Beginner explanation

Row is horizontal; column is vertical.

Developer explanation

From a developer point of view, `flex-direction` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-direction: value;

Detailed example

.card {
  flex-direction: row;
}
Browser result / output:The selected element renders with `flex-direction: row` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
rowleft to right in LTR
row-reversereverse row
columntop to bottom
column-reversereverse column

Real-time production scope

  • Use `flex-direction` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-direction` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-direction` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 166 of 295 Next ❯

flex-wrap

What it is

Controls whether flex items wrap onto multiple lines.

Beginner explanation

Use wrap for responsive card rows.

Developer explanation

From a developer point of view, `flex-wrap` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-wrap: value;

Detailed example

.card {
  flex-wrap: wrap;
}
Browser result / output:The selected element renders with `flex-wrap: wrap` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
nowrapsingle line
wrapmultiple lines
wrap-reversereverse cross-axis wrapping

Real-time production scope

  • Use `flex-wrap` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-wrap` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-wrap` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 167 of 295 Next ❯

flex-flow

What it is

Shorthand for flex-direction and flex-wrap.

Beginner explanation

Use it to set direction and wrapping together.

Developer explanation

From a developer point of view, `flex-flow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-flow: value;

Detailed example

.card {
  flex-flow: row wrap;
}
Browser result / output:The selected element renders with `flex-flow: row wrap` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
firstflex-direction
secondflex-wrap

Real-time production scope

  • Use `flex-flow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-flow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-flow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 168 of 295 Next ❯

justify-content

What it is

Aligns flex items along the main axis.

Beginner explanation

Use it for horizontal distribution in row layouts.

Developer explanation

From a developer point of view, `justify-content` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

justify-content: value;

Detailed example

.card {
  justify-content: space-between;
}
Browser result / output:The selected element renders with `justify-content: space-between` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
flex-startstart
centercenter
space-betweenspread edges
space-aroundspace around
space-evenlyequal spaces

Real-time production scope

  • Use `justify-content` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `justify-content` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `justify-content` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 169 of 295 Next ❯

align-items

What it is

Aligns flex items on the cross axis.

Beginner explanation

Use it for vertical alignment in row layouts.

Developer explanation

From a developer point of view, `align-items` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

align-items: value;

Detailed example

.card {
  align-items: center;
}
Browser result / output:The selected element renders with `align-items: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
stretchdefault
flex-startstart
centercenter
flex-endend
baselinetext baseline

Real-time production scope

  • Use `align-items` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `align-items` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `align-items` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 170 of 295 Next ❯

align-content

What it is

Aligns multiple flex lines in the cross axis.

Beginner explanation

Only matters when wrapping creates multiple lines.

Developer explanation

From a developer point of view, `align-content` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

align-content: value;

Detailed example

.card {
  align-content: center;
}
Browser result / output:The selected element renders with `align-content: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
stretchdefault
centercenter lines
space-betweendistribute lines

Real-time production scope

  • Use `align-content` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `align-content` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `align-content` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 171 of 295 Next ❯

gap

What it is

Adds space between flex or grid items.

Beginner explanation

Use gap instead of margins for modern layout spacing.

Developer explanation

From a developer point of view, `gap` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

gap: value;

Detailed example

.card {
  gap: 1rem;
}
Browser result / output:The selected element renders with `gap: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
row-gapvertical gap
column-gaphorizontal gap
gapboth

Real-time production scope

  • Use `gap` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `gap` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `gap` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 172 of 295 Next ❯

row-gap

What it is

Sets row spacing between flex/grid lines.

Beginner explanation

Useful when vertical and horizontal gaps differ.

Developer explanation

From a developer point of view, `row-gap` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

row-gap: value;

Detailed example

.card {
  row-gap: 1rem;
}
Browser result / output:The selected element renders with `row-gap: 1rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
percentagecontext-dependent

Real-time production scope

  • Use `row-gap` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `row-gap` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `row-gap` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 173 of 295 Next ❯

column-gap

What it is

Sets column spacing between flex/grid columns.

Beginner explanation

Useful in card grids and navs.

Developer explanation

From a developer point of view, `column-gap` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

column-gap: value;

Detailed example

.card {
  column-gap: 1.5rem;
}
Browser result / output:The selected element renders with `column-gap: 1.5rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthpx/rem
normaldefault

Real-time production scope

  • Use `column-gap` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `column-gap` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `column-gap` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 174 of 295 Next ❯

flex

What it is

Shorthand for flex-grow, flex-shrink, and flex-basis.

Beginner explanation

Controls how a flex item grows/shrinks.

Developer explanation

From a developer point of view, `flex` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex: value;

Detailed example

.card {
  flex: 1 1 300px;
}
Browser result / output:The selected element renders with `flex: 1 1 300px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
growfirst value
shrinksecond value
basisthird value

Real-time production scope

  • Use `flex` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 175 of 295 Next ❯

flex-grow

What it is

Controls how much an item grows relative to others.

Beginner explanation

0 means do not grow; 1 means share free space.

Developer explanation

From a developer point of view, `flex-grow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-grow: value;

Detailed example

.card {
  flex-grow: 1;
}
Browser result / output:The selected element renders with `flex-grow: 1` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
0do not grow
1+grow share

Real-time production scope

  • Use `flex-grow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-grow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-grow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 176 of 295 Next ❯

flex-shrink

What it is

Controls how much an item shrinks relative to others.

Beginner explanation

0 prevents shrinking.

Developer explanation

From a developer point of view, `flex-shrink` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-shrink: value;

Detailed example

.card {
  flex-shrink: 1;
}
Browser result / output:The selected element renders with `flex-shrink: 1` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
0do not shrink
1default shrink

Real-time production scope

  • Use `flex-shrink` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-shrink` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-shrink` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 177 of 295 Next ❯

flex-basis

What it is

Sets initial size before free space distribution.

Beginner explanation

Use it for card minimum widths.

Developer explanation

From a developer point of view, `flex-basis` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

flex-basis: value;

Detailed example

.card {
  flex-basis: 280px;
}
Browser result / output:The selected element renders with `flex-basis: 280px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autocontent/width based
lengthfixed starting size
0distribute from zero

Real-time production scope

  • Use `flex-basis` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `flex-basis` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `flex-basis` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 178 of 295 Next ❯

align-self

What it is

Overrides align-items for one flex item.

Beginner explanation

Use it for one item that should align differently.

Developer explanation

From a developer point of view, `align-self` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

align-self: value;

Detailed example

.card {
  align-self: flex-end;
}
Browser result / output:The selected element renders with `align-self: flex-end` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autouse parent align-items
centercenter item
stretchstretch item

Real-time production scope

  • Use `align-self` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `align-self` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `align-self` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 179 of 295 Next ❯

order

What it is

Changes visual order of flex/grid items.

Beginner explanation

Use sparingly because DOM order remains unchanged for accessibility.

Developer explanation

From a developer point of view, `order` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

order: value;

Detailed example

.card {
  order: 2;
}
Browser result / output:The selected element renders with `order: 2` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
default0
negativecomes earlier
positivecomes later

Real-time production scope

  • Use `order` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `order` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `order` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 180 of 295 Next ❯

display: grid

What it is

Turns an element into a grid container.

Beginner explanation

Its direct children become grid items arranged in rows and columns.

Developer explanation

CSS Grid is two-dimensional layout: it controls rows and columns together. Use it for page layouts, dashboards, galleries, forms, and complex card arrangements.

Syntax / pattern

display: grid;

Detailed example

.dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}
Browser result / output:The dashboard gets a sidebar column and a main content column.

Important values / related concepts

Value / conceptMeaning / usage
gridblock grid container
inline-gridinline grid container

Real-time production scope

  • Use grid for page shells, dashboards, galleries, and forms.
  • Combine grid for outer layout with flexbox inside components.

Common mistakes and fixes

  • Using grid without thinking about mobile stacking.
  • Confusing align-items with align-content.
  • Forgetting direct children are grid items.

Practice task

Practice: Build a two-column dashboard layout with display:grid.

Official study links

❮ Previous Topic 181 of 295 Next ❯

grid-template-columns

What it is

Defines explicit grid columns.

Beginner explanation

Use it to create columns such as `1fr 1fr 1fr`.

Developer explanation

From a developer point of view, `grid-template-columns` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-template-columns: value;

Detailed example

.card {
  grid-template-columns: repeat(3, 1fr);
}
Browser result / output:The selected element renders with `grid-template-columns: repeat(3, 1fr)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthfixed columns
frflexible columns
repeatrepeat pattern
minmaxrange

Real-time production scope

  • Use `grid-template-columns` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-template-columns` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-template-columns` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 182 of 295 Next ❯

grid-template-rows

What it is

Defines explicit grid rows.

Beginner explanation

Use it for fixed or flexible row tracks.

Developer explanation

From a developer point of view, `grid-template-rows` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-template-rows: value;

Detailed example

.card {
  grid-template-rows: auto 1fr auto;
}
Browser result / output:The selected element renders with `grid-template-rows: auto 1fr auto` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autocontent-sized
frflexible
lengthfixed

Real-time production scope

  • Use `grid-template-rows` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-template-rows` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-template-rows` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 183 of 295 Next ❯

grid-template-areas

What it is

Defines named layout areas.

Beginner explanation

Makes page layout readable using area names.

Developer explanation

From a developer point of view, `grid-template-areas` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-template-areas: value;

Detailed example

.card {
  grid-template-areas: "header header" "sidebar main" "footer footer";
}
Browser result / output:The selected element renders with `grid-template-areas: "header header" "sidebar main" "footer footer"` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
area namesassigned by grid-area
dotempty cell

Real-time production scope

  • Use `grid-template-areas` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-template-areas` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-template-areas` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 184 of 295 Next ❯

grid-area

What it is

Assigns an item to a named area or row/column coordinates.

Beginner explanation

Use with grid-template-areas for page layout.

Developer explanation

From a developer point of view, `grid-area` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-area: value;

Detailed example

.card {
  grid-area: main;
}
Browser result / output:The selected element renders with `grid-area: main` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
namenamed area
line syntaxrow-start / col-start / row-end / col-end

Real-time production scope

  • Use `grid-area` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-area` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-area` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 185 of 295 Next ❯

grid-column

What it is

Sets a grid item's column start/end.

Beginner explanation

Use it to make items span columns.

Developer explanation

From a developer point of view, `grid-column` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-column: value;

Detailed example

.card {
  grid-column: span 2;
}
Browser result / output:The selected element renders with `grid-column: span 2` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
spanspan tracks
1 / 3line start/end

Real-time production scope

  • Use `grid-column` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-column` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-column` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 186 of 295 Next ❯

grid-row

What it is

Sets a grid item's row start/end.

Beginner explanation

Use it to make items span rows.

Developer explanation

From a developer point of view, `grid-row` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-row: value;

Detailed example

.card {
  grid-row: span 2;
}
Browser result / output:The selected element renders with `grid-row: span 2` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
spanspan tracks
1 / 4line start/end

Real-time production scope

  • Use `grid-row` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-row` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-row` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 187 of 295 Next ❯

grid-auto-flow

What it is

Controls how auto-placed grid items flow.

Beginner explanation

Use dense packing carefully.

Developer explanation

From a developer point of view, `grid-auto-flow` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-auto-flow: value;

Detailed example

.card {
  grid-auto-flow: row;
}
Browser result / output:The selected element renders with `grid-auto-flow: row` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
rowfill rows
columnfill columns
densebackfill holes

Real-time production scope

  • Use `grid-auto-flow` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-auto-flow` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-auto-flow` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 188 of 295 Next ❯

grid-auto-columns

What it is

Sets size for implicit columns.

Beginner explanation

Used when items create columns not defined in template.

Developer explanation

From a developer point of view, `grid-auto-columns` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-auto-columns: value;

Detailed example

.card {
  grid-auto-columns: 1fr;
}
Browser result / output:The selected element renders with `grid-auto-columns: 1fr` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthfixed implicit columns
frflexible

Real-time production scope

  • Use `grid-auto-columns` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-auto-columns` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-auto-columns` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 189 of 295 Next ❯

grid-auto-rows

What it is

Sets size for implicit rows.

Beginner explanation

Useful for card grids and calendars.

Developer explanation

From a developer point of view, `grid-auto-rows` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

grid-auto-rows: value;

Detailed example

.card {
  grid-auto-rows: minmax(120px, auto);
}
Browser result / output:The selected element renders with `grid-auto-rows: minmax(120px, auto)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autocontent
lengthfixed
minmaxrange

Real-time production scope

  • Use `grid-auto-rows` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `grid-auto-rows` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `grid-auto-rows` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 190 of 295 Next ❯

justify-items

What it is

Aligns grid items inside their cells horizontally/inline axis.

Beginner explanation

Use it for item alignment inside cells.

Developer explanation

From a developer point of view, `justify-items` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

justify-items: value;

Detailed example

.card {
  justify-items: center;
}
Browser result / output:The selected element renders with `justify-items: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
stretchdefault
startstart
centercenter
endend

Real-time production scope

  • Use `justify-items` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `justify-items` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `justify-items` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 191 of 295 Next ❯

align-items

What it is

Aligns grid items inside their cells vertically/block axis.

Beginner explanation

In grid, this controls item alignment in cells.

Developer explanation

From a developer point of view, `align-items` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

align-items: value;

Detailed example

.card {
  align-items: start;
}
Browser result / output:The selected element renders with `align-items: start` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
stretchdefault
starttop
centermiddle
endbottom

Real-time production scope

  • Use `align-items` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `align-items` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `align-items` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 192 of 295 Next ❯

place-items

What it is

Shorthand for align-items and justify-items.

Beginner explanation

Use it to center grid items quickly.

Developer explanation

From a developer point of view, `place-items` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

place-items: value;

Detailed example

.card {
  place-items: center;
}
Browser result / output:The selected element renders with `place-items: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueboth axes
two valuesalign justify

Real-time production scope

  • Use `place-items` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `place-items` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `place-items` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 193 of 295 Next ❯

justify-content

What it is

Aligns the whole grid inside the container on the inline axis.

Beginner explanation

Works when grid is smaller than container.

Developer explanation

From a developer point of view, `justify-content` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

justify-content: value;

Detailed example

.card {
  justify-content: center;
}
Browser result / output:The selected element renders with `justify-content: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
startleft/start
centercenter
space-betweendistribute tracks

Real-time production scope

  • Use `justify-content` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `justify-content` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `justify-content` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 194 of 295 Next ❯

align-content

What it is

Aligns the whole grid inside the container on the block axis.

Beginner explanation

Works when grid is smaller than container height.

Developer explanation

From a developer point of view, `align-content` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

align-content: value;

Detailed example

.card {
  align-content: center;
}
Browser result / output:The selected element renders with `align-content: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
starttop
centermiddle
space-betweendistribute rows

Real-time production scope

  • Use `align-content` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `align-content` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `align-content` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 195 of 295 Next ❯

place-content

What it is

Shorthand for align-content and justify-content.

Beginner explanation

Use it to align the entire grid both ways.

Developer explanation

From a developer point of view, `place-content` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

place-content: value;

Detailed example

.card {
  place-content: center;
}
Browser result / output:The selected element renders with `place-content: center` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
one valueboth axes
two valuesalign justify

Real-time production scope

  • Use `place-content` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `place-content` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `place-content` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 196 of 295 Next ❯

repeat()

What it is

Repeats track definitions.

Beginner explanation

Use repeat(3, 1fr) instead of writing 1fr three times.

Developer explanation

From a developer point of view, `repeat()` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

repeat(): value;

Detailed example

.card {
  repeat(): repeat(3, 1fr);
}
Browser result / output:The selected element renders with `repeat(): repeat(3, 1fr)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
fixed countrepeat(3, 1fr)
auto-fitresponsive tracks
auto-fillfill with empty tracks

Real-time production scope

  • Use `repeat()` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `repeat()` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `repeat()` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 197 of 295 Next ❯

minmax()

What it is

Defines a track minimum and maximum size.

Beginner explanation

Common in responsive grids.

Developer explanation

From a developer point of view, `minmax()` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

minmax(): value;

Detailed example

.card {
  minmax(): minmax(250px, 1fr);
}
Browser result / output:The selected element renders with `minmax(): minmax(250px, 1fr)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
minminimum track
maxmaximum track

Real-time production scope

  • Use `minmax()` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `minmax()` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `minmax()` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 198 of 295 Next ❯

auto-fit

What it is

Collapses empty repeated tracks and stretches filled tracks.

Beginner explanation

Use for responsive card grids.

Developer explanation

From a developer point of view, `auto-fit` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

auto-fit: value;

Detailed example

.card {
  auto-fit: repeat(auto-fit, minmax(250px, 1fr));
}
Browser result / output:The selected element renders with `auto-fit: repeat(auto-fit, minmax(250px, 1fr))` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
behaviorfit existing items
best forresponsive card grids

Real-time production scope

  • Use `auto-fit` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `auto-fit` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `auto-fit` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 199 of 295 Next ❯

auto-fill

What it is

Creates as many tracks as possible, including empty tracks.

Beginner explanation

Use when empty slots should reserve space.

Developer explanation

From a developer point of view, `auto-fill` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

auto-fill: value;

Detailed example

.card {
  auto-fill: repeat(auto-fill, minmax(250px, 1fr));
}
Browser result / output:The selected element renders with `auto-fill: repeat(auto-fill, minmax(250px, 1fr))` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
behaviorfill with tracks
differencedoes not collapse empty tracks like auto-fit

Real-time production scope

  • Use `auto-fill` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `auto-fill` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `auto-fill` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 200 of 295 Next ❯

subgrid

What it is

Allows nested grid items to align with parent grid tracks.

Beginner explanation

Useful for consistent card layouts and nested page regions where supported.

Developer explanation

From a developer point of view, `subgrid` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

subgrid: value;

Detailed example

.card {
  subgrid: grid-template-columns: subgrid;
}
Browser result / output:The selected element renders with `subgrid: grid-template-columns: subgrid` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
best fornested alignment
supportmodern browser support improving

Real-time production scope

  • Use `subgrid` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `subgrid` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `subgrid` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 201 of 295 Next ❯

Responsive Design

What it is

Responsive design makes a page work on phones, tablets, laptops, and large screens.

Beginner explanation

Layouts should adapt instead of forcing one desktop layout everywhere.

Developer explanation

Use fluid sizes, flexible layouts, media queries, container queries, responsive images, and progressive enhancement.

Syntax / pattern

mobile-first CSS + breakpoints

Detailed example

.grid { display: grid; gap: 1rem; }
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
Browser result / output:Cards stack on mobile and become two columns on tablets.

Important values / related concepts

Value / conceptMeaning / usage
mobile-firststart small, enhance larger
desktop-firststart large, override smaller

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using Responsive Design.

Official study links

❮ Previous Topic 202 of 295 Next ❯

@media

What it is

`@media` applies CSS only when media conditions match.

Beginner explanation

Use it to change layout at breakpoints.

Developer explanation

Media queries can test width, height, orientation, pointer, hover, color scheme, print, and more.

Syntax / pattern

@media (min-width: 768px) { ... }

Detailed example

@media (min-width: 768px) {
  .sidebar { display: block; }
}
Browser result / output:Sidebar appears when viewport is at least 768px wide.

Important values / related concepts

Value / conceptMeaning / usage
min-widthmobile-first
max-widthdesktop-first
printprint styles

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using @media.

Official study links

❮ Previous Topic 203 of 295 Next ❯

min-width Media Query

What it is

A min-width media query applies styles from a size and up.

Beginner explanation

It is the common mobile-first approach.

Developer explanation

Use min-width breakpoints to progressively enhance layouts as space increases.

Syntax / pattern

@media (min-width: 768px)

Detailed example

.cards { display: grid; gap: 1rem; }
@media (min-width: 768px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
Browser result / output:One column on mobile, two columns from 768px.

Important values / related concepts

Value / conceptMeaning / usage
best formobile-first CSS
benefitfewer overrides

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using min-width Media Query.

Official study links

❮ Previous Topic 204 of 295 Next ❯

max-width Media Query

What it is

A max-width media query applies styles up to a size.

Beginner explanation

Useful for targeted small-screen fixes.

Developer explanation

Use sparingly in a mobile-first architecture; too many max-width overrides can become hard to manage.

Syntax / pattern

@media (max-width: 767px)

Detailed example

@media (max-width: 767px) {
  .desktop-only { display: none; }
}
Browser result / output:Desktop-only content hides on small screens.

Important values / related concepts

Value / conceptMeaning / usage
best forsmall-screen exceptions
cautionoverrides can pile up

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using max-width Media Query.

Official study links

❮ Previous Topic 205 of 295 Next ❯

orientation Media Query

What it is

Orientation queries detect portrait or landscape viewport orientation.

Beginner explanation

Useful for full-screen mobile layouts.

Developer explanation

Use orientation only when layout genuinely depends on orientation, not just width.

Syntax / pattern

@media (orientation: landscape)

Detailed example

@media (orientation: landscape) {
  .hero { min-height: 80vh; }
}
Browser result / output:Hero height changes in landscape orientation.

Important values / related concepts

Value / conceptMeaning / usage
portraitheight >= width often
landscapewidth > height often

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using orientation Media Query.

Official study links

❮ Previous Topic 206 of 295 Next ❯

hover Media Feature

What it is

The hover media feature detects whether the primary input can hover.

Beginner explanation

Useful for disabling hover-only effects on touch devices.

Developer explanation

Use it to add hover enhancements only where hover exists.

Syntax / pattern

@media (hover: hover)

Detailed example

@media (hover: hover) {
  .card:hover { transform: translateY(-4px); }
}
Browser result / output:Card hover lift only applies on devices that support hover.

Important values / related concepts

Value / conceptMeaning / usage
hovercan hover
noneno convenient hover

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using hover Media Feature.

Official study links

❮ Previous Topic 207 of 295 Next ❯

pointer Media Feature

What it is

The pointer media feature checks pointer accuracy.

Beginner explanation

Coarse means touch; fine means mouse/stylus.

Developer explanation

Use it to increase tap targets for touch devices.

Syntax / pattern

@media (pointer: coarse)

Detailed example

@media (pointer: coarse) {
  .button { min-height: 44px; }
}
Browser result / output:Buttons become easier to tap on touch devices.

Important values / related concepts

Value / conceptMeaning / usage
coarsefinger/touch
finemouse/stylus

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using pointer Media Feature.

Official study links

❮ Previous Topic 208 of 295 Next ❯

prefers-color-scheme

What it is

Detects whether the user prefers light or dark mode.

Beginner explanation

Use it to automatically provide dark theme.

Developer explanation

Pair with CSS variables so theme changes are simple.

Syntax / pattern

@media (prefers-color-scheme: dark)

Detailed example

:root { --bg: white; --text: #111827; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f172a; --text: #e5e7eb; }
}
body { background: var(--bg); color: var(--text); }
Browser result / output:The page switches colors based on system theme.

Important values / related concepts

Value / conceptMeaning / usage
darkdark preference
lightlight preference

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using prefers-color-scheme.

Official study links

❮ Previous Topic 209 of 295 Next ❯

prefers-reduced-motion

What it is

Detects whether the user prefers reduced motion.

Beginner explanation

Important for users sensitive to animation.

Developer explanation

Disable or simplify non-essential animations when reduced motion is requested.

Syntax / pattern

@media (prefers-reduced-motion: reduce)

Detailed example

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
Browser result / output:Animations become effectively disabled for users who request reduced motion.

Important values / related concepts

Value / conceptMeaning / usage
reduceminimize motion
no-preferencenormal

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using prefers-reduced-motion.

Official study links

❮ Previous Topic 210 of 295 Next ❯

Container Queries

What it is

Container queries apply styles based on a container's size, not the viewport.

Beginner explanation

A card can change layout depending on how much space its parent gives it.

Developer explanation

Use container queries for reusable components that appear in different layout areas.

Syntax / pattern

@container (min-width: 500px)

Detailed example

.card-shell { container-type: inline-size; }
@container (min-width: 500px) {
  .course-card { display: grid; grid-template-columns: 180px 1fr; }
}
Browser result / output:Course card changes layout when its container is wide enough.

Important values / related concepts

Value / conceptMeaning / usage
container-typeenables querying
best forreusable responsive components

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using Container Queries.

Official study links

❮ Previous Topic 211 of 295 Next ❯

container-type

What it is

Defines an element as a query container.

Beginner explanation

Needed before child styles can use @container queries.

Developer explanation

Use `inline-size` for most component width queries.

Syntax / pattern

container-type: inline-size;

Detailed example

.card-shell { container-type: inline-size; }
Browser result / output:Children can now respond to `.card-shell` width.

Important values / related concepts

Value / conceptMeaning / usage
inline-sizequery width/inline axis
sizequery both axes

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using container-type.

Official study links

❮ Previous Topic 212 of 295 Next ❯

container-name

What it is

Gives a container a name for targeted container queries.

Beginner explanation

Useful when nested containers exist.

Developer explanation

Use names to avoid applying a query to the wrong ancestor.

Syntax / pattern

container-name: sidebar;

Detailed example

.sidebar { container-name: sidebar; container-type: inline-size; }
@container sidebar (min-width: 300px) { .widget { padding: 1rem; } }
Browser result / output:Widget styles apply based on the named sidebar container.

Important values / related concepts

Value / conceptMeaning / usage
nameidentifier for @container
usespecific container targeting

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using container-name.

Official study links

❮ Previous Topic 213 of 295 Next ❯

@supports

What it is

`@supports` applies CSS only if the browser supports a feature.

Beginner explanation

Use it for progressive enhancement.

Developer explanation

Feature queries let you ship modern CSS while keeping fallback styles for older browsers.

Syntax / pattern

@supports (display: grid) { ... }

Detailed example

.layout { display: block; }
@supports (display: grid) {
  .layout { display: grid; grid-template-columns: 1fr 2fr; }
}
Browser result / output:Older browsers use block layout; supporting browsers use grid.

Important values / related concepts

Value / conceptMeaning / usage
positive@supports (property: value)
negative@supports not (...)

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using @supports.

Official study links

❮ Previous Topic 214 of 295 Next ❯

Print CSS

What it is

Print CSS styles pages when users print or save as PDF.

Beginner explanation

Use it to hide navbars and format content for paper.

Developer explanation

Add print-specific rules for invoices, certificates, reports, and documentation.

Syntax / pattern

@media print { ... }

Detailed example

@media print {
  .sidebar, .button { display: none; }
  body { color: black; background: white; }
}
Browser result / output:Sidebar/buttons disappear in print output.

Important values / related concepts

Value / conceptMeaning / usage
use forreports, invoices, certificates
checkprint preview

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using Print CSS.

Official study links

❮ Previous Topic 215 of 295 Next ❯

Responsive Images with CSS

What it is

CSS can make images scale within their containers.

Beginner explanation

Use `max-width: 100%` so images do not overflow.

Developer explanation

Combine CSS with HTML srcset/picture for performance and responsive delivery.

Syntax / pattern

img { max-width: 100%; height: auto; }

Detailed example

img { max-width: 100%; height: auto; display: block; }
Browser result / output:Images shrink to fit their parent while keeping aspect ratio.

Important values / related concepts

Value / conceptMeaning / usage
max-widthprevent overflow
height autopreserve ratio

Real-time production scope

  • Start with mobile styles first.
  • Use flexible layouts and fluid typography.
  • Test real content, not only dummy cards.

Common mistakes and fixes

  • Choosing breakpoints only for devices instead of content needs.
  • Forgetting tap target sizes.
  • Making desktop-only hover interactions.

Practice task

Practice: Build a responsive course card and improve it using Responsive Images with CSS.

Official study links

❮ Previous Topic 216 of 295 Next ❯

transition

What it is

Animates changes between property values.

Beginner explanation

Use it for hover/focus state changes.

Developer explanation

From a developer point of view, `transition` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transition: value;

Detailed example

.card {
  transition: background-color 200ms ease, transform 200ms ease;
}
Browser result / output:The selected element renders with `transition: background-color 200ms ease, transform 200ms ease` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
propertywhat changes
durationhow long
timingeasing
delaywait before start

Real-time production scope

  • Use `transition` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transition` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transition` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 217 of 295 Next ❯

transition-property

What it is

Chooses which properties transition.

Beginner explanation

Use specific properties instead of `all` for performance.

Developer explanation

From a developer point of view, `transition-property` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transition-property: value;

Detailed example

.card {
  transition-property: transform, opacity;
}
Browser result / output:The selected element renders with `transition-property: transform, opacity` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
specifictransform, opacity
allevery animatable property but may be inefficient

Real-time production scope

  • Use `transition-property` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transition-property` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transition-property` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 218 of 295 Next ❯

transition-duration

What it is

Sets how long a transition takes.

Beginner explanation

Short transitions feel responsive.

Developer explanation

From a developer point of view, `transition-duration` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transition-duration: value;

Detailed example

.card {
  transition-duration: 200ms;
}
Browser result / output:The selected element renders with `transition-duration: 200ms` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
msmilliseconds
sseconds

Real-time production scope

  • Use `transition-duration` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transition-duration` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transition-duration` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 219 of 295 Next ❯

transition-timing-function

What it is

Controls easing curve for transition.

Beginner explanation

Defines how speed changes over time.

Developer explanation

From a developer point of view, `transition-timing-function` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transition-timing-function: value;

Detailed example

.card {
  transition-timing-function: ease-in-out;
}
Browser result / output:The selected element renders with `transition-timing-function: ease-in-out` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
easedefault-ish smooth
linearconstant
ease-in/outaccelerate/decelerate
cubic-beziercustom

Real-time production scope

  • Use `transition-timing-function` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transition-timing-function` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transition-timing-function` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 220 of 295 Next ❯

transition-delay

What it is

Delays the start of a transition.

Beginner explanation

Use sparingly for staggered effects.

Developer explanation

From a developer point of view, `transition-delay` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transition-delay: value;

Detailed example

.card {
  transition-delay: 100ms;
}
Browser result / output:The selected element renders with `transition-delay: 100ms` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
0sno delay
positivestarts later

Real-time production scope

  • Use `transition-delay` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transition-delay` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transition-delay` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 221 of 295 Next ❯

transform

What it is

Applies 2D/3D transformations.

Beginner explanation

Use transform for movement, scaling, rotation, and skewing.

Developer explanation

From a developer point of view, `transform` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transform: value;

Detailed example

.card {
  transform: translateY(-4px);
}
Browser result / output:The selected element renders with `transform: translateY(-4px)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
translatemove
scaleresize visually
rotateturn
skewslant

Real-time production scope

  • Use `transform` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transform` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transform` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 222 of 295 Next ❯

translate

What it is

Moves an element in 2D/3D space.

Beginner explanation

Modern individual transform property.

Developer explanation

From a developer point of view, `translate` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

translate: value;

Detailed example

.card {
  translate: 0 -4px;
}
Browser result / output:The selected element renders with `translate: 0 -4px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
x y2D movement
z3D with transform context

Real-time production scope

  • Use `translate` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `translate` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `translate` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 223 of 295 Next ❯

scale

What it is

Scales an element visually.

Beginner explanation

Useful for hover emphasis and animations.

Developer explanation

From a developer point of view, `scale` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scale: value;

Detailed example

.card {
  scale: 1.05;
}
Browser result / output:The selected element renders with `scale: 1.05` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
1normal
>1larger
<1smaller

Real-time production scope

  • Use `scale` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scale` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scale` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 224 of 295 Next ❯

rotate

What it is

Rotates an element.

Beginner explanation

Use for icons, arrows, loaders.

Developer explanation

From a developer point of view, `rotate` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

rotate: value;

Detailed example

.card {
  rotate: 6deg;
}
Browser result / output:The selected element renders with `rotate: 6deg` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
degdegrees
turnturns
radradians

Real-time production scope

  • Use `rotate` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `rotate` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `rotate` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 225 of 295 Next ❯

skew

What it is

Slants an element.

Beginner explanation

Use sparingly for decorative effects.

Developer explanation

From a developer point of view, `skew` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

skew: value;

Detailed example

.card {
  skew: 10deg;
}
Browser result / output:The selected element renders with `skew: 10deg` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
x/yskew axes
cautioncan distort text

Real-time production scope

  • Use `skew` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `skew` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `skew` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 226 of 295 Next ❯

transform-origin

What it is

Sets the point transformations happen around.

Beginner explanation

Use it for dropdowns, rotations, and scale animations.

Developer explanation

From a developer point of view, `transform-origin` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

transform-origin: value;

Detailed example

.card {
  transform-origin: top right;
}
Browser result / output:The selected element renders with `transform-origin: top right` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
keywordscenter, top right
percent50% 50%
length10px 20px

Real-time production scope

  • Use `transform-origin` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `transform-origin` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `transform-origin` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 227 of 295 Next ❯

animation

What it is

Shorthand for CSS keyframe animation.

Beginner explanation

Use it for loaders, entrance effects, and decorative motion.

Developer explanation

From a developer point of view, `animation` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation: value;

Detailed example

.card {
  animation: fadeIn 300ms ease both;
}
Browser result / output:The selected element renders with `animation: fadeIn 300ms ease both` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
namekeyframes name
durationtime
timingeasing
fillbefore/after state

Real-time production scope

  • Use `animation` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 228 of 295 Next ❯

@keyframes

What it is

The `@keyframes` at-rule defines the intermediate steps of a CSS animation.

Beginner explanation

It tells the browser what styles an element should have at the start, during, and end of an animation.

Developer explanation

Keyframes should animate compositor-friendly properties like transform and opacity when possible for better performance. Pair animations with `prefers-reduced-motion` so motion-sensitive users are protected.

Syntax / pattern

@keyframes name { from { ... } to { ... } }

Detailed example

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 300ms ease-out both;
}
Browser result / output:The card fades into view and moves slightly upward when it appears.

Important values / related concepts

Value / conceptMeaning / usage
from/toShortcut for 0% and 100% animation states
percentagesUse 0%, 50%, 100% for multiple stages
animation-nameMust match the keyframes name

Real-time production scope

  • Use transform and opacity for smoother animations.
  • Respect prefers-reduced-motion.
  • Keep animations purposeful and short.

Common mistakes and fixes

  • Animating layout-heavy properties like width/height frequently.
  • Forgetting animation-duration.
  • Using infinite animations unnecessarily.

Practice task

Practice: Create a fadeIn keyframes animation and apply it to a card.

Official study links

❮ Previous Topic 229 of 295 Next ❯

animation-name

What it is

Chooses which keyframes to use.

Beginner explanation

Must match an @keyframes name.

Developer explanation

From a developer point of view, `animation-name` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-name: value;

Detailed example

.card {
  animation-name: fadeIn;
}
Browser result / output:The selected element renders with `animation-name: fadeIn` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
noneno animation
custom namematches @keyframes

Real-time production scope

  • Use `animation-name` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-name` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-name` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 230 of 295 Next ❯

animation-duration

What it is

Sets how long one animation cycle lasts.

Beginner explanation

Short for UI, longer for decorative effects.

Developer explanation

From a developer point of view, `animation-duration` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-duration: value;

Detailed example

.card {
  animation-duration: 600ms;
}
Browser result / output:The selected element renders with `animation-duration: 600ms` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
ms/stime values
requiredwithout duration animation may not visibly run

Real-time production scope

  • Use `animation-duration` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-duration` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-duration` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 231 of 295 Next ❯

animation-timing-function

What it is

Controls animation easing.

Beginner explanation

Like transition timing but for keyframes.

Developer explanation

From a developer point of view, `animation-timing-function` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-timing-function: value;

Detailed example

.card {
  animation-timing-function: ease-out;
}
Browser result / output:The selected element renders with `animation-timing-function: ease-out` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
easesmooth
linearconstant
steps()stepped
cubic-beziercustom

Real-time production scope

  • Use `animation-timing-function` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-timing-function` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-timing-function` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 232 of 295 Next ❯

animation-delay

What it is

Delays animation start.

Beginner explanation

Use for staggered entrance effects.

Developer explanation

From a developer point of view, `animation-delay` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-delay: value;

Detailed example

.card {
  animation-delay: 150ms;
}
Browser result / output:The selected element renders with `animation-delay: 150ms` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
positivewait
negativestart partway through

Real-time production scope

  • Use `animation-delay` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-delay` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-delay` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 233 of 295 Next ❯

animation-iteration-count

What it is

Sets how many times an animation repeats.

Beginner explanation

Use infinite for loaders only where appropriate.

Developer explanation

From a developer point of view, `animation-iteration-count` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-iteration-count: value;

Detailed example

.card {
  animation-iteration-count: infinite;
}
Browser result / output:The selected element renders with `animation-iteration-count: infinite` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
number1,2,3
infiniteloops forever

Real-time production scope

  • Use `animation-iteration-count` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-iteration-count` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-iteration-count` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 234 of 295 Next ❯

animation-direction

What it is

Controls whether animation alternates or reverses.

Beginner explanation

Useful for pulsing effects.

Developer explanation

From a developer point of view, `animation-direction` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-direction: value;

Detailed example

.card {
  animation-direction: alternate;
}
Browser result / output:The selected element renders with `animation-direction: alternate` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normalforward
reversebackward
alternateforward then backward

Real-time production scope

  • Use `animation-direction` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-direction` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-direction` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 235 of 295 Next ❯

animation-fill-mode

What it is

Controls styles before/after animation.

Beginner explanation

`both` is common for entrance animations.

Developer explanation

From a developer point of view, `animation-fill-mode` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-fill-mode: value;

Detailed example

.card {
  animation-fill-mode: both;
}
Browser result / output:The selected element renders with `animation-fill-mode: both` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
nonedefault
forwardskeep final styles
backwardsapply first keyframe before start
bothboth

Real-time production scope

  • Use `animation-fill-mode` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-fill-mode` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-fill-mode` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 236 of 295 Next ❯

animation-play-state

What it is

Pauses or runs animation.

Beginner explanation

Useful for hover pause or JS control.

Developer explanation

From a developer point of view, `animation-play-state` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

animation-play-state: value;

Detailed example

.card {
  animation-play-state: paused;
}
Browser result / output:The selected element renders with `animation-play-state: paused` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
runningactive
pausedstopped at current position

Real-time production scope

  • Use `animation-play-state` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `animation-play-state` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `animation-play-state` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 237 of 295 Next ❯

filter

What it is

Applies graphical effects to an element.

Beginner explanation

Use for blur, brightness, grayscale, shadows.

Developer explanation

From a developer point of view, `filter` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

filter: value;

Detailed example

.card {
  filter: grayscale(100%);
}
Browser result / output:The selected element renders with `filter: grayscale(100%)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
blur()soften
brightness()adjust light
grayscale()remove color
drop-shadow()shadow based on alpha

Real-time production scope

  • Use `filter` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `filter` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `filter` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 238 of 295 Next ❯

backdrop-filter

What it is

Applies effects behind an element.

Beginner explanation

Used for glassmorphism overlays.

Developer explanation

From a developer point of view, `backdrop-filter` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

backdrop-filter: value;

Detailed example

.card {
  backdrop-filter: blur(12px);
}
Browser result / output:The selected element renders with `backdrop-filter: blur(12px)` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
blurglass effect
brightnessbackdrop lighting
supporttest browser support

Real-time production scope

  • Use `backdrop-filter` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `backdrop-filter` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `backdrop-filter` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 239 of 295 Next ❯

mix-blend-mode

What it is

Controls how an element blends with content behind it.

Beginner explanation

Use for creative overlays.

Developer explanation

From a developer point of view, `mix-blend-mode` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

mix-blend-mode: value;

Detailed example

.card {
  mix-blend-mode: multiply;
}
Browser result / output:The selected element renders with `mix-blend-mode: multiply` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
normaldefault
multiplydarken
screenlighten
differencecontrast effect

Real-time production scope

  • Use `mix-blend-mode` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `mix-blend-mode` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `mix-blend-mode` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 240 of 295 Next ❯

cursor

What it is

Controls mouse cursor appearance.

Beginner explanation

Use pointer for clickable custom controls.

Developer explanation

From a developer point of view, `cursor` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

cursor: value;

Detailed example

.card {
  cursor: pointer;
}
Browser result / output:The selected element renders with `cursor: pointer` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autobrowser decides
pointerclickable
not-alloweddisabled
texttext selection

Real-time production scope

  • Use `cursor` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `cursor` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `cursor` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 241 of 295 Next ❯

pointer-events

What it is

Controls whether an element can receive pointer events.

Beginner explanation

Useful for overlays or decorative elements.

Developer explanation

From a developer point of view, `pointer-events` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

pointer-events: value;

Detailed example

.card {
  pointer-events: none;
}
Browser result / output:The selected element renders with `pointer-events: none` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autonormal
noneignore pointer events

Real-time production scope

  • Use `pointer-events` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `pointer-events` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `pointer-events` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 242 of 295 Next ❯

user-select

What it is

Controls whether text can be selected.

Beginner explanation

Use none for buttons/icons, but do not block useful text selection.

Developer explanation

From a developer point of view, `user-select` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

user-select: value;

Detailed example

.card {
  user-select: none;
}
Browser result / output:The selected element renders with `user-select: none` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autodefault
textselectable
nonenot selectable
allselect all at once

Real-time production scope

  • Use `user-select` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `user-select` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `user-select` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 243 of 295 Next ❯

caret-color

What it is

Sets the text input cursor color.

Beginner explanation

Use for branded forms.

Developer explanation

From a developer point of view, `caret-color` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

caret-color: value;

Detailed example

.card {
  caret-color: #2563eb;
}
Browser result / output:The selected element renders with `caret-color: #2563eb` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autobrowser default
colorcustom caret

Real-time production scope

  • Use `caret-color` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `caret-color` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `caret-color` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 244 of 295 Next ❯

resize

What it is

Controls whether textarea or elements can be resized.

Beginner explanation

Useful for textareas.

Developer explanation

From a developer point of view, `resize` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

resize: value;

Detailed example

.card {
  resize: vertical;
}
Browser result / output:The selected element renders with `resize: vertical` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
nonedisable
bothboth directions
verticalheight only
horizontalwidth only

Real-time production scope

  • Use `resize` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `resize` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `resize` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 245 of 295 Next ❯

appearance

What it is

Controls native platform appearance of UI controls.

Beginner explanation

Useful for custom form styling.

Developer explanation

From a developer point of view, `appearance` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

appearance: value;

Detailed example

.card {
  appearance: none;
}
Browser result / output:The selected element renders with `appearance: none` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autonative
noneremove native styling where supported

Real-time production scope

  • Use `appearance` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `appearance` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `appearance` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 246 of 295 Next ❯

appearance: none

What it is

Removes native styling from controls where supported.

Beginner explanation

Often used for custom select/checkbox/search styles.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

appearance: none { ... }

Detailed example

input {
  none;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
use withselect, input, button
cautionrebuild accessible states

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its appearance: none state.

Official study links

❮ Previous Topic 247 of 295 Next ❯

placeholder Styling

What it is

Styles input placeholder text using `::placeholder`.

Beginner explanation

Make placeholder readable but not confused with actual input.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

placeholder { ... }

Detailed example

input {
  #9ca3af;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
selectorinput::placeholder
avoidplaceholder-only labels

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its placeholder Styling state.

Official study links

❮ Previous Topic 248 of 295 Next ❯

:disabled Styling

What it is

Styles disabled controls.

Beginner explanation

Communicates unavailable actions.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

:disabled { ... }

Detailed example

input:disabled Styling {
  opacity: 0.5;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
selector:disabled
usebuttons/inputs

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its :disabled Styling state.

Official study links

❮ Previous Topic 249 of 295 Next ❯

:invalid Styling

What it is

Styles invalid form fields.

Beginner explanation

Shows validation feedback.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

:invalid { ... }

Detailed example

input:invalid Styling {
  border-color: #dc2626;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
selector:invalid
cautionmay apply before user interaction

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its :invalid Styling state.

Official study links

❮ Previous Topic 250 of 295 Next ❯

:valid Styling

What it is

Styles valid form fields.

Beginner explanation

Shows success feedback.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

:valid { ... }

Detailed example

input:valid Styling {
  border-color: #16a34a;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
selector:valid
useform UX

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its :valid Styling state.

Official study links

❮ Previous Topic 251 of 295 Next ❯

focus Ring Styling

What it is

Creates visible focus styles.

Beginner explanation

Keyboard users need to see where focus is.

Developer explanation

UI state styling must communicate behavior without breaking accessibility. Always test keyboard, mouse, touch, disabled, invalid, and loading states.

Syntax / pattern

focus Ring { ... }

Detailed example

input {
  outline: 3px solid #93c5fd;
}
Browser result / output:The form control visually reflects the selected UI state.

Important values / related concepts

Value / conceptMeaning / usage
selector:focus-visible
must havevisible contrast

Real-time production scope

  • Use labels and visible states.
  • Do not hide focus outlines without replacement.
  • Test in real browsers.

Common mistakes and fixes

  • Relying only on color for errors.
  • Using placeholder as the only label.
  • Removing native appearance without rebuilding states.

Practice task

Practice: Create an input field and style its focus Ring Styling state.

Official study links

❮ Previous Topic 252 of 295 Next ❯

list-style-type

What it is

Controls bullet or numbering style.

Beginner explanation

Use it for lists when default bullets/numbers need changes.

Developer explanation

From a developer point of view, `list-style-type` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

list-style-type: value;

Detailed example

.card {
  list-style-type: disc;
}
Browser result / output:The selected element renders with `list-style-type: disc` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
disc/circle/squareunordered
decimal/lower-alphaordered
noneremove marker

Real-time production scope

  • Use `list-style-type` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `list-style-type` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `list-style-type` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 253 of 295 Next ❯

list-style-position

What it is

Controls marker position inside or outside content box.

Beginner explanation

Outside is default.

Developer explanation

From a developer point of view, `list-style-position` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

list-style-position: value;

Detailed example

.card {
  list-style-position: outside;
}
Browser result / output:The selected element renders with `list-style-position: outside` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
outsidemarker outside
insidemarker inside

Real-time production scope

  • Use `list-style-position` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `list-style-position` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `list-style-position` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 254 of 295 Next ❯

list-style-image

What it is

Uses an image as list marker.

Beginner explanation

Use sparingly; pseudo-elements offer more control.

Developer explanation

From a developer point of view, `list-style-image` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

list-style-image: value;

Detailed example

.card {
  list-style-image: url('check.svg');
}
Browser result / output:The selected element renders with `list-style-image: url('check.svg')` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
urlcustom image
nonedefault

Real-time production scope

  • Use `list-style-image` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `list-style-image` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `list-style-image` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 255 of 295 Next ❯

::marker

What it is

Styles list markers.

Beginner explanation

Use it to color or size bullets/numbers.

Developer explanation

From a developer point of view, `::marker` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

::marker: value;

Detailed example

.card {
  ::marker: color: #2563eb;
}
Browser result / output:The selected element renders with `::marker: color: #2563eb` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
propertiescolor, font-size, content in supported cases

Real-time production scope

  • Use `::marker` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `::marker` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `::marker` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 256 of 295 Next ❯

border-collapse

What it is

Controls whether table cell borders collapse.

Beginner explanation

Use collapse for clean data tables.

Developer explanation

From a developer point of view, `border-collapse` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-collapse: value;

Detailed example

.card {
  border-collapse: collapse;
}
Browser result / output:The selected element renders with `border-collapse: collapse` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
separatedefault separated borders
collapseshared borders

Real-time production scope

  • Use `border-collapse` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `border-collapse` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-collapse` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 257 of 295 Next ❯

border-spacing

What it is

Sets spacing between table cell borders when border-collapse is separate.

Beginner explanation

Useful for spaced table layouts.

Developer explanation

From a developer point of view, `border-spacing` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

border-spacing: value;

Detailed example

.card {
  border-spacing: 0.5rem;
}
Browser result / output:The selected element renders with `border-spacing: 0.5rem` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthhorizontal and vertical spacing

Real-time production scope

  • Use `border-spacing` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `border-spacing` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `border-spacing` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 258 of 295 Next ❯

caption-side

What it is

Controls where table caption appears.

Beginner explanation

Usually top; sometimes bottom for reports.

Developer explanation

From a developer point of view, `caption-side` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

caption-side: value;

Detailed example

.card {
  caption-side: top;
}
Browser result / output:The selected element renders with `caption-side: top` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
topabove table
bottombelow table

Real-time production scope

  • Use `caption-side` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `caption-side` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `caption-side` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 259 of 295 Next ❯

empty-cells

What it is

Controls whether borders/backgrounds show for empty table cells.

Beginner explanation

Applies when border-collapse is separate.

Developer explanation

From a developer point of view, `empty-cells` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

empty-cells: value;

Detailed example

.card {
  empty-cells: show;
}
Browser result / output:The selected element renders with `empty-cells: show` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
showdisplay empty cells
hidehide empty cells

Real-time production scope

  • Use `empty-cells` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `empty-cells` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `empty-cells` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 260 of 295 Next ❯

vertical-align

What it is

Aligns inline/table-cell content vertically.

Beginner explanation

Useful for table cells and inline icons.

Developer explanation

From a developer point of view, `vertical-align` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

vertical-align: value;

Detailed example

.card {
  vertical-align: middle;
}
Browser result / output:The selected element renders with `vertical-align: middle` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
baselinedefault
middlecenter-ish
top/bottomedges

Real-time production scope

  • Use `vertical-align` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `vertical-align` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `vertical-align` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 261 of 295 Next ❯

scroll-behavior

What it is

Controls smooth scrolling for navigation.

Beginner explanation

Use smooth for anchor links if appropriate.

Developer explanation

From a developer point of view, `scroll-behavior` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scroll-behavior: value;

Detailed example

.card {
  scroll-behavior: smooth;
}
Browser result / output:The selected element renders with `scroll-behavior: smooth` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autoinstant
smoothanimated scroll

Real-time production scope

  • Use `scroll-behavior` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scroll-behavior` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scroll-behavior` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 262 of 295 Next ❯

scroll-margin

What it is

Adds margin when scrolling an element into view.

Beginner explanation

Useful with sticky headers.

Developer explanation

From a developer point of view, `scroll-margin` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scroll-margin: value;

Detailed example

.card {
  scroll-margin: 80px;
}
Browser result / output:The selected element renders with `scroll-margin: 80px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthspace around target
logicalscroll-margin-top etc.

Real-time production scope

  • Use `scroll-margin` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scroll-margin` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scroll-margin` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 263 of 295 Next ❯

scroll-padding

What it is

Adds padding to scroll container snap/anchor area.

Beginner explanation

Useful when sticky header covers anchors.

Developer explanation

From a developer point of view, `scroll-padding` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scroll-padding: value;

Detailed example

.card {
  scroll-padding: 80px;
}
Browser result / output:The selected element renders with `scroll-padding: 80px` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
lengthsafe scroll inset
containerscroll container

Real-time production scope

  • Use `scroll-padding` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scroll-padding` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scroll-padding` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 264 of 295 Next ❯

scroll-snap-type

What it is

Enables scroll snapping on a container.

Beginner explanation

Use for carousels and full-screen sections.

Developer explanation

From a developer point of view, `scroll-snap-type` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scroll-snap-type: value;

Detailed example

.card {
  scroll-snap-type: x mandatory;
}
Browser result / output:The selected element renders with `scroll-snap-type: x mandatory` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
x/y/bothaxis
mandatory/proximitystrictness

Real-time production scope

  • Use `scroll-snap-type` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scroll-snap-type` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scroll-snap-type` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 265 of 295 Next ❯

scroll-snap-align

What it is

Sets snap position for child items.

Beginner explanation

Used with scroll-snap-type.

Developer explanation

From a developer point of view, `scroll-snap-align` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

scroll-snap-align: value;

Detailed example

.card {
  scroll-snap-align: start;
}
Browser result / output:The selected element renders with `scroll-snap-align: start` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
startalign start
centeralign center
endalign end

Real-time production scope

  • Use `scroll-snap-align` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `scroll-snap-align` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `scroll-snap-align` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 266 of 295 Next ❯

overscroll-behavior

What it is

Controls scroll chaining.

Beginner explanation

Useful for modals and side panels.

Developer explanation

From a developer point of view, `overscroll-behavior` is part of the rendering contract for an element. It should be chosen based on layout, accessibility, responsiveness, browser support, and maintainability. Prefer reusable classes and design tokens instead of repeating random values across many components.

Syntax / pattern

overscroll-behavior: value;

Detailed example

.card {
  overscroll-behavior: contain;
}
Browser result / output:The selected element renders with `overscroll-behavior: contain` applied. Inspect it in browser DevTools under the Computed styles panel.

Important values / related concepts

Value / conceptMeaning / usage
autodefault
containstop chaining
nonealso prevent browser effects

Real-time production scope

  • Use `overscroll-behavior` inside reusable component classes, not only inline styles.
  • Test the result on mobile, tablet, and desktop sizes.
  • Keep values consistent with your design system tokens.

Common mistakes and fixes

  • Changing `overscroll-behavior` without checking inherited or overridden styles.
  • Using fixed values where responsive values would be better.
  • Forgetting to test focus, hover, overflow, and small-screen states.

Practice task

Practice: Create three elements and apply different `overscroll-behavior` values. Compare the visual result using DevTools.

Official study links

❮ Previous Topic 267 of 295 Next ❯

@charset

What it is

Declares stylesheet character encoding.

Beginner explanation

Usually not needed if files are served as UTF-8.

Developer explanation

Must appear at the very start if used.

Syntax / pattern

@charset "UTF-8";

Detailed example

@charset "UTF-8";
body { font-family: system-ui; }
Browser result / output:The CSS file is interpreted as UTF-8.

Important values / related concepts

Value / conceptMeaning / usage
positionmust be first

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @charset.

Official study links

❮ Previous Topic 268 of 295 Next ❯

@namespace

What it is

Defines XML namespaces for selectors.

Beginner explanation

Mostly used with SVG/XML, rarely in normal websites.

Developer explanation

It lets selectors target elements in a namespace.

Syntax / pattern

@namespace svg url("http://www.w3.org/2000/svg");

Detailed example

@namespace svg url("http://www.w3.org/2000/svg");
svg|a { fill: blue; }
Browser result / output:Namespaced SVG links can be selected.

Important values / related concepts

Value / conceptMeaning / usage
common useXML/SVG specialized cases

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @namespace.

Official study links

❮ Previous Topic 269 of 295 Next ❯

@import

What it is

Imports another stylesheet.

Beginner explanation

Useful but can affect loading performance.

Developer explanation

Prefer build tools or link tags for large production apps.

Syntax / pattern

@import url("theme.css");

Detailed example

@import url("tokens.css");
@import url("components.css");
Browser result / output:Imported CSS rules become part of the stylesheet.

Important values / related concepts

Value / conceptMeaning / usage
must be earlybefore most style rules
performancecan add network waterfall

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @import.

Official study links

❮ Previous Topic 270 of 295 Next ❯

@layer

What it is

Creates cascade layers.

Beginner explanation

Use it to control styling priority by layer.

Developer explanation

Helpful when mixing reset, framework, component, and utility CSS.

Syntax / pattern

@layer base, components, utilities;

Detailed example

@layer base { body { font-family: system-ui; } }
@layer components { .btn { padding: .75rem 1rem; } }
Browser result / output:Layer order controls which rules win.

Important values / related concepts

Value / conceptMeaning / usage
order mattersdeclared layer order
usearchitecture

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @layer.

Official study links

❮ Previous Topic 271 of 295 Next ❯

@scope

What it is

Scopes CSS rules to a subtree where supported.

Beginner explanation

Use it to limit selectors to a component area.

Developer explanation

It can reduce accidental global styling in modern CSS.

Syntax / pattern

@scope (.card) { ... }

Detailed example

@scope (.card) {
  h2 { color: #2563eb; }
}
Browser result / output:h2 styles apply only inside .card scope.

Important values / related concepts

Value / conceptMeaning / usage
usecomponent scoping
supportcheck browser compatibility

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @scope.

Official study links

❮ Previous Topic 272 of 295 Next ❯

@property

What it is

Defines typed custom properties.

Beginner explanation

Use it to make custom properties animatable and controlled.

Developer explanation

Useful for advanced animations and design tokens with syntax/initial values.

Syntax / pattern

@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

Detailed example

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.loader { transform: rotate(var(--angle)); }
Browser result / output:The custom property has a type and default.

Important values / related concepts

Value / conceptMeaning / usage
syntaxtype of custom property
inheritstrue/false
initial-valuedefault

Real-time production scope

  • Use at-rules intentionally.
  • Check browser support before relying on newer at-rules.
  • Keep architecture simple for learners.

Common mistakes and fixes

  • Putting @import after normal rules.
  • Using experimental features without fallbacks.
  • Overengineering small pages.

Practice task

Practice: Create a small demo using @property.

Official study links

❮ Previous Topic 273 of 295 Next ❯

CSS Reset

What it is

A CSS reset removes or normalizes browser default styles.

Beginner explanation

It gives a more consistent starting point.

Developer explanation

Use a small modern reset that preserves accessibility. Do not blindly remove focus outlines or list semantics.

Syntax / pattern

reset rules at start of CSS

Detailed example

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { max-width: 100%; display: block; }
Browser result / output:Pages start with consistent box sizing, no body margin, and responsive images.

Important values / related concepts

Value / conceptMeaning / usage
purposeconsistent baseline
cautiondo not remove accessibility

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS Reset to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 274 of 295 Next ❯

Normalize CSS

What it is

Normalize keeps useful browser defaults while making them consistent.

Beginner explanation

It is less aggressive than a full reset.

Developer explanation

Useful when building from native HTML defaults and forms.

Syntax / pattern

import normalize or write small normalization

Detailed example

button, input, textarea, select { font: inherit; }
Browser result / output:Form controls inherit site font.

Important values / related concepts

Value / conceptMeaning / usage
purposepreserve defaults
commonform normalization

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Normalize CSS to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 275 of 295 Next ❯

Design Tokens

What it is

Design tokens are named values for colors, spacing, font sizes, shadows, and radii.

Beginner explanation

They avoid repeating random values.

Developer explanation

Use CSS custom properties for tokens so themes and components stay consistent.

Syntax / pattern

--space-4: 1rem;

Detailed example

:root {
  --color-brand: #2563eb;
  --space-4: 1rem;
  --radius-card: 12px;
}
.card { padding: var(--space-4); border-radius: var(--radius-card); }
Browser result / output:All cards use the same tokenized spacing and radius.

Important values / related concepts

Value / conceptMeaning / usage
examplescolor, spacing, font, radius
benefitconsistency

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Design Tokens to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 276 of 295 Next ❯

BEM Naming

What it is

BEM is a class naming convention: Block, Element, Modifier.

Beginner explanation

It makes component class names predictable.

Developer explanation

Use BEM or another consistent convention to avoid unclear class names and specificity problems.

Syntax / pattern

.block__element--modifier

Detailed example

.course-card { }
.course-card__title { }
.course-card--featured { }
Browser result / output:Classes clearly describe component parts and states.

Important values / related concepts

Value / conceptMeaning / usage
blockcomponent
elementpart
modifiervariation

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply BEM Naming to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 277 of 295 Next ❯

Utility Classes

What it is

Utility classes are small single-purpose classes.

Beginner explanation

Example: `.text-center`, `.mt-4`, `.hidden`.

Developer explanation

Utilities speed up development but need a system to avoid messy HTML.

Syntax / pattern

.utility { one job }

Detailed example

.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.hidden { display: none; }
Browser result / output:Elements can reuse small styling helpers.

Important values / related concepts

Value / conceptMeaning / usage
best forspacing, text alignment, visibility
cautiontoo many can reduce readability

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Utility Classes to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 278 of 295 Next ❯

Component CSS

What it is

Component CSS styles one reusable UI part.

Beginner explanation

A card, button, modal, navbar, or form group can have its own classes.

Developer explanation

Keep component styles self-contained and avoid leaking styles to unrelated elements.

Syntax / pattern

.component { ... }

Detailed example

.course-card { padding: 1rem; border: 1px solid #ddd; }
.course-card__title { margin: 0; }
Browser result / output:Course card styles are reusable and predictable.

Important values / related concepts

Value / conceptMeaning / usage
componentreusable UI block
goalisolation and reuse

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Component CSS to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 279 of 295 Next ❯

CSS File Organization

What it is

Organize CSS by base, layout, components, utilities, and pages.

Beginner explanation

Large CSS files need structure.

Developer explanation

A predictable file structure helps teams maintain features without accidental overrides.

Syntax / pattern

base → layout → components → utilities

Detailed example

css/
  base.css
  tokens.css
  layout.css
  buttons.css
  cards.css
  forms.css
  utilities.css
Browser result / output:Developers can find and update styles quickly.

Important values / related concepts

Value / conceptMeaning / usage
small projectsingle file okay
large projectseparate by purpose

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS File Organization to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 280 of 295 Next ❯

Naming Conventions

What it is

Class names should describe purpose, not just color or current appearance.

Beginner explanation

Use names like `.primary-button` or `.course-card`.

Developer explanation

Avoid names that become wrong when design changes, like `.blue-box` for a card that may become green.

Syntax / pattern

class="course-card"

Detailed example

.course-card { }
.course-card__meta { }
.course-card--inactive { }
Browser result / output:Class names remain meaningful as design evolves.

Important values / related concepts

Value / conceptMeaning / usage
goodsemantic component names
avoidpurely visual names unless utility

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Naming Conventions to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 281 of 295 Next ❯

CSS Variables Theme

What it is

Themes can be built by changing CSS custom property values.

Beginner explanation

Switch colors by changing variables, not every component rule.

Developer explanation

Theme variables are powerful for dark mode, admin themes, brand variants, and white-label apps.

Syntax / pattern

theme class overrides tokens

Detailed example

:root { --bg: white; --text: #111; }
[data-theme="dark"] { --bg: #111827; --text: #f9fafb; }
body { background: var(--bg); color: var(--text); }
Browser result / output:Changing data-theme changes page colors.

Important values / related concepts

Value / conceptMeaning / usage
best fordark mode and branding
scopecan theme whole page or subtree

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS Variables Theme to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 282 of 295 Next ❯

Dark Mode

What it is

Dark mode is a theme optimized for low-light interfaces.

Beginner explanation

Use prefers-color-scheme or a manual toggle.

Developer explanation

Do not simply invert colors. Check contrast, shadows, borders, images, and status colors.

Syntax / pattern

@media (prefers-color-scheme: dark)

Detailed example

@media (prefers-color-scheme: dark) {
  :root { --bg: #0f172a; --text: #e5e7eb; --surface: #111827; }
}
Browser result / output:The page adapts to system dark mode.

Important values / related concepts

Value / conceptMeaning / usage
automaticprefers-color-scheme
manualdata-theme toggle

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Dark Mode to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 283 of 295 Next ❯

Accessibility in CSS

What it is

CSS must preserve readable text, visible focus, sufficient contrast, and usable layout.

Beginner explanation

Good styling helps everyone use the page.

Developer explanation

Never remove accessibility affordances without replacing them. Test keyboard navigation, zoom, reduced motion, and high contrast.

Syntax / pattern

focus, contrast, motion, zoom

Detailed example

:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
Browser result / output:Keyboard users can see focused elements.

Important values / related concepts

Value / conceptMeaning / usage
must checkfocus, contrast, zoom, motion
avoiddisplay:none for important content

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Accessibility in CSS to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 284 of 295 Next ❯

Performance in CSS

What it is

CSS performance affects rendering speed and smoothness.

Beginner explanation

Large complex styles can slow pages.

Developer explanation

Optimize critical CSS, avoid expensive selectors in huge DOMs, animate transform/opacity, and reduce unused CSS.

Syntax / pattern

fast selectors + small CSS + compositor animations

Detailed example

.card { transition: transform 200ms ease; }
.card:hover { transform: translateY(-4px); }
Browser result / output:The hover animation runs smoothly because transform is efficient.

Important values / related concepts

Value / conceptMeaning / usage
animatetransform and opacity
avoidlayout-heavy animations

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Performance in CSS to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 285 of 295 Next ❯

CSS Debugging Workflow

What it is

Debug CSS with DevTools, not guessing.

Beginner explanation

Inspect the element and check computed styles and layout panels.

Developer explanation

Use DevTools for cascade, box model, flex/grid overlays, responsive view, color contrast, and performance.

Syntax / pattern

Inspect → Styles → Computed → Layout

Detailed example

/* In DevTools, toggle this rule */
.card { outline: 2px solid red; }
Browser result / output:The outline helps identify layout boundaries.

Important values / related concepts

Value / conceptMeaning / usage
toolsElements, Styles, Computed, Layout
strategyisolate one issue at a time

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS Debugging Workflow to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 286 of 295 Next ❯

Cross-Browser CSS

What it is

Browsers may support features at different times.

Beginner explanation

Test important pages in major browsers.

Developer explanation

Use progressive enhancement, @supports, and fallbacks for newer CSS.

Syntax / pattern

fallback first, modern enhancement second

Detailed example

.layout { display: block; }
@supports (display: grid) { .layout { display: grid; } }
Browser result / output:Old browsers get block layout; modern ones get grid.

Important values / related concepts

Value / conceptMeaning / usage
strategyfallbacks
testChrome, Edge, Firefox, Safari where relevant

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Cross-Browser CSS to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 287 of 295 Next ❯

CSS and SEO

What it is

CSS does not directly create SEO content, but it affects usability, performance, and layout stability.

Beginner explanation

Good CSS helps users read and navigate.

Developer explanation

Avoid hiding important content, causing layout shift, or making mobile pages unusable.

Syntax / pattern

readable + responsive + stable

Detailed example

img { max-width: 100%; height: auto; }
.article { max-width: 70ch; }
Browser result / output:Content is readable and mobile-friendly.

Important values / related concepts

Value / conceptMeaning / usage
SEO impactUX, mobile, performance
avoidhidden keyword stuffing

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS and SEO to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 288 of 295 Next ❯

CSS and Print Certificates

What it is

Print CSS can create printable certificates, invoices, and reports.

Beginner explanation

Use @media print to remove controls and adjust page size.

Developer explanation

For certificates, set print dimensions, hide UI buttons, and use high-contrast text.

Syntax / pattern

@media print { ... }

Detailed example

@media print {
  .no-print { display: none; }
  .certificate { box-shadow: none; page-break-inside: avoid; }
}
Browser result / output:The certificate prints without buttons or shadows.

Important values / related concepts

Value / conceptMeaning / usage
use forcertificates, invoices, reports
testprint preview and PDF export

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply CSS and Print Certificates to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 289 of 295 Next ❯

Final CSS Checklist

What it is

A checklist helps verify production CSS quality.

Beginner explanation

Before publishing, check responsive, accessibility, performance, and maintainability.

Developer explanation

Teams should make CSS review part of pull requests and QA.

Syntax / pattern

review checklist

Detailed example

/* Check: mobile, focus, contrast, print, unused CSS, naming, tokens */
Browser result / output:Your page is more likely to work reliably in production.

Important values / related concepts

Value / conceptMeaning / usage
quality areasresponsive, accessibility, performance, maintainability

Real-time production scope

  • Use consistent design tokens.
  • Keep CSS modular and searchable.
  • Review with real content and real devices.

Common mistakes and fixes

  • Writing global styles that accidentally break components.
  • Ignoring accessibility and motion preferences.
  • Not deleting unused CSS.

Practice task

Practice: Apply Final CSS Checklist to your learning page or dashboard CSS.

Official study links

❮ Previous Topic 290 of 295 Next ❯

Project: Responsive Course Card

What it is

Build a reusable course card with image, title, description, tags, and CTA button.

Beginner explanation

This project practices box model, typography, flex/grid, buttons, responsive images, and hover states.

Developer explanation

A developer builds this as a component that can repeat for many courses or internships.

Syntax / pattern

HTML + CSS component

Detailed example

<article class="course-card">
  <img src="html-course.jpg" alt="HTML course preview">
  <div class="course-card__body">
    <h2>HTML Complete Tutorial</h2>
    <p>Learn HTML with examples and projects.</p>
    <a class="button" href="learn-html.html">Start Learning</a>
  </div>
</article>

.course-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgb(0 0 0 / 8%);
}
.course-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
}
Browser result / output:A clean card layout appears and can be reused in a course catalog.

Important values / related concepts

Value / conceptMeaning / usage
conceptsgrid, border, radius, shadow, object-fit

Real-time production scope

  • Start with semantic HTML.
  • Add tokens first, then components.
  • Test at 360px, 768px, 1024px, and large desktop.

Common mistakes and fixes

  • Styling before understanding layout requirements.
  • Forgetting mobile sidebar behavior.
  • Not checking code block overflow.

Practice task

Practice: Build and customize the Project: Responsive Course Card using your own colors and content.

Official study links

❮ Previous Topic 291 of 295 Next ❯

Project: Responsive Navbar

What it is

Build a header/navigation bar that works on desktop and mobile.

Beginner explanation

This project practices flexbox, spacing, links, hover, focus, and responsive behavior.

Developer explanation

In production, navbars need accessible focus, good tap targets, and mobile layout strategy.

Syntax / pattern

header + nav + flexbox

Detailed example

<header class="site-header">
  <a class="logo" href="index.html">NGCXAI</a>
  <nav class="nav" aria-label="Main navigation">
    <a href="learning-center.html">Learning</a>
    <a href="dashboard.html">Dashboard</a>
    <a href="contact.html">Contact</a>
  </nav>
</header>

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}
.nav {
  display: flex;
  gap: 1rem;
}
Browser result / output:Logo appears left, navigation links appear right on wider screens.

Important values / related concepts

Value / conceptMeaning / usage
conceptsflex, gap, focus-visible, media queries

Real-time production scope

  • Start with semantic HTML.
  • Add tokens first, then components.
  • Test at 360px, 768px, 1024px, and large desktop.

Common mistakes and fixes

  • Styling before understanding layout requirements.
  • Forgetting mobile sidebar behavior.
  • Not checking code block overflow.

Practice task

Practice: Build and customize the Project: Responsive Navbar using your own colors and content.

Official study links

❮ Previous Topic 292 of 295 Next ❯

Project: Admin Dashboard Layout

What it is

Build a dashboard shell with sidebar, header, and main content.

Beginner explanation

This project practices CSS Grid, sticky sidebar, overflow, cards, and responsive layout.

Developer explanation

Admin dashboards need predictable layout, scroll behavior, and readable tables.

Syntax / pattern

grid page shell

Detailed example

.dashboard {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
}
.sidebar { grid-area: sidebar; }
.header { grid-area: header; }
.main { grid-area: main; overflow: auto; }

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar { display: none; }
}
Browser result / output:Desktop shows sidebar + content; mobile hides sidebar for a simpler layout.

Important values / related concepts

Value / conceptMeaning / usage
conceptsgrid areas, media queries, overflow

Real-time production scope

  • Start with semantic HTML.
  • Add tokens first, then components.
  • Test at 360px, 768px, 1024px, and large desktop.

Common mistakes and fixes

  • Styling before understanding layout requirements.
  • Forgetting mobile sidebar behavior.
  • Not checking code block overflow.

Practice task

Practice: Build and customize the Project: Admin Dashboard Layout using your own colors and content.

Official study links

❮ Previous Topic 293 of 295 Next ❯

Project: Form Styling System

What it is

Build consistent input, label, button, error, and success styles.

Beginner explanation

This project practices form states, focus, validation, spacing, and accessibility.

Developer explanation

Production forms must be keyboard-friendly, readable, and show clear error states.

Syntax / pattern

form CSS

Detailed example

.form-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.input {
  font: inherit;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}
.input:focus-visible {
  outline: 3px solid #bfdbfe;
  border-color: #2563eb;
}
.input:invalid {
  border-color: #dc2626;
}
Browser result / output:Inputs become consistent, accessible, and visually clear.

Important values / related concepts

Value / conceptMeaning / usage
conceptsfont inherit, focus-visible, invalid, spacing

Real-time production scope

  • Start with semantic HTML.
  • Add tokens first, then components.
  • Test at 360px, 768px, 1024px, and large desktop.

Common mistakes and fixes

  • Styling before understanding layout requirements.
  • Forgetting mobile sidebar behavior.
  • Not checking code block overflow.

Practice task

Practice: Build and customize the Project: Form Styling System using your own colors and content.

Official study links

❮ Previous Topic 294 of 295 Next ❯

Project: Full Learning Page Theme

What it is

Build a complete CSS theme for tutorial pages like Python, HTML, Java, .NET, and CSS.

Beginner explanation

This project combines layout, typography, sidebar, code blocks, tables, notes, responsive design, and search UI styling.

Developer explanation

A reusable learning theme reduces duplicated work and keeps all course pages visually consistent.

Syntax / pattern

design tokens + layout + components

Detailed example

:root {
  --brand: #306998;
  --accent: #ffd43b;
  --surface: #ffffff;
  --text: #1f2937;
  --radius: 12px;
}
.learn-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
}
.lesson {
  max-width: 1100px;
  padding: 2rem;
}
.code-block {
  background: #111827;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: var(--radius);
}
Browser result / output:All learning pages can share the same theme and layout patterns.

Important values / related concepts

Value / conceptMeaning / usage
conceptstokens, grid, components, responsive, code blocks

Real-time production scope

  • Start with semantic HTML.
  • Add tokens first, then components.
  • Test at 360px, 768px, 1024px, and large desktop.

Common mistakes and fixes

  • Styling before understanding layout requirements.
  • Forgetting mobile sidebar behavior.
  • Not checking code block overflow.

Practice task

Practice: Build and customize the Project: Full Learning Page Theme using your own colors and content.

Official study links

❮ Previous Topic 295 of 295 Next ❯

Official CSS References

What it is

Use trusted references to verify CSS properties, values, browser support, selectors, at-rules, and accessibility guidance.

Beginner explanation

When learning a CSS property, always check what it does, allowed values, examples, browser compatibility, and accessibility notes.

Developer explanation

Professional developers use MDN, W3C specifications, W3Schools examples, browser DevTools, and caniuse-style compatibility research to avoid guessing.

Syntax / pattern

reference → verify → test in browser

Detailed example

/* Study workflow */
1. Read the concept.
2. Try a small example.
3. Inspect in DevTools.
4. Test responsive behavior.
5. Add it to a real component.
Browser result / output:You build reliable CSS knowledge instead of memorizing disconnected examples.

Important values / related concepts

Value / conceptMeaning / usage
MDNReference and browser compatibility
W3CSpecifications
W3SchoolsBeginner examples and exercises
DevToolsDebugging applied CSS

Real-time production scope

  • Keep official links inside every lesson.
  • Validate behavior in actual browsers.
  • Prefer accessible, responsive patterns.

Common mistakes and fixes

  • Copying random snippets without understanding them.
  • Not testing in the browser.
  • Ignoring browser support and accessibility.

Practice task

Practice: Choose any 10 CSS properties from this tutorial and verify their values in MDN.

Official study links