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 / concept | Meaning / usage |
|---|---|
CSS role | Presentation and layout |
HTML role | Meaning and structure |
JavaScript role | Behavior 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
Official study links
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 / concept | Meaning / usage |
|---|---|
selector | Targets HTML elements |
property | The style feature you want to control |
value | The setting assigned to the property |
declaration | property plus value |
block | Declarations 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
Official study links
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 / concept | Meaning / usage |
|---|---|
single form | CSS has one comment syntax: /* ... */ |
not nested | Avoid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Best for | Small demos, email templates, dynamic one-off values |
Avoid for | Reusable 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Best for | Single-file tutorials, prototypes, small landing pages |
Avoid for | Large 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Best for | Production websites and apps |
Benefit | Reusable, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Best for | Small demos or layered CSS organization |
Caution | May 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Specificity | 0-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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | All `<p>` elements |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | All elements with `class="card"` |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Element with `id="hero"` |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | All h1, h2, and h3 elements |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | All links anywhere inside `.nav` |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Only li elements directly inside `.menu` |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | The first p immediately after each h2 |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | All p elements after an h2 in the same parent |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Email input fields |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Elements whose class list includes active |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Links where href starts with https |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Links ending with .pdf |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Elements where data-role contains admin |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Inputs whose type equals email regardless of case |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Buttons on mouse hover |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Focused input |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Keyboard-focused buttons |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Link while being clicked |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Visited links |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | li that is first child |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | li that is last child |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Even table rows |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Second paragraph among paragraphs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Buttons that do not have disabled class |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | h1, h2, and h3 |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | h1, h2, and h3 |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Cards containing an img |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Checked inputs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Disabled buttons |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Valid inputs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Invalid inputs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Generated content before badge text |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Generated content after link text |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | First letter of paragraphs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | First line of paragraphs |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | User-selected text |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
Matches | Elements matching either selector |
Specificity note | Specificity 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
Official study links
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 / concept | Meaning / usage |
|---|---|
main factors | importance, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
ID | strong |
class/attribute/pseudo-class | medium |
type/pseudo-element | low |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
usually inherits | color, font-family, font-size, line-height |
usually not inherit | margin, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
equal specificity | later wins |
different specificity | stronger 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
Official study links
!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 / concept | Meaning / usage |
|---|---|
use carefully | utility overrides, accessibility fixes |
avoid | normal 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
Official study links
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 / concept | Meaning / usage |
|---|---|
common layers | reset, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
scope | variables 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best tool | Browser DevTools |
use for | specificity, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | borders, small fixed measurements |
caution | fixed 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
Official study links
% 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 / concept | Meaning / usage |
|---|---|
relative to | property-specific context |
good for | fluid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
relative to | current font-size |
caution | nested 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
Official study links
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 / concept | Meaning / usage |
|---|---|
relative to | html/root font-size |
best for | typography 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
Official study links
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 / concept | Meaning / usage |
|---|---|
1vw | 1% viewport width |
common use | fluid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
1vh | 1% viewport height |
mobile caution | use 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | mobile full-screen sections |
support | modern 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
Official study links
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 / concept | Meaning / usage |
|---|---|
based on | min(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
Official study links
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 / concept | Meaning / usage |
|---|---|
based on | max(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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | text containers |
common range | 60-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
Official study links
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 / concept | Meaning / usage |
|---|---|
only for | CSS Grid tracks |
meaning | fraction 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
Official study links
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 / concept | Meaning / usage |
|---|---|
common use | centering, automatic sizing |
depends on | property 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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | force inheritance |
common use | form 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
Official study links
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 / concept | Meaning / usage |
|---|---|
resets to | CSS initial value |
not same as | browser 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
Official study links
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 / concept | Meaning / usage |
|---|---|
for inherited | inherit |
for non-inherited | initial |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | undo author styling |
use carefully | can 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
Official study links
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 / concept | Meaning / usage |
|---|---|
supports | +, -, *, / in modern CSS |
common use | fluid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | choose smallest |
best for | fluid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | choose largest |
best for | minimum 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
Official study links
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 / concept | Meaning / usage |
|---|---|
arguments | minimum, preferred, maximum |
best for | responsive 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
Official study links
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 / concept | Meaning / usage |
|---|---|
fallback | var(--token, fallback) |
common use | themes 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
Official study links
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 / concept | Meaning / usage |
|---|---|
path base | relative to CSS file location |
common use | backgrounds 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
Official study links
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 / concept | Meaning / usage |
|---|---|
common support | content property |
caution | accessibility |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
direction | to right, 135deg, etc. |
use | background-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
Official study links
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 / concept | Meaning / usage |
|---|---|
shape | circle or ellipse |
position | at 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
Official study links
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 / concept | Meaning / usage |
|---|---|
common use | transitions and animations |
debug | DevTools 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
Official study links
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 / concept | Meaning / usage |
|---|---|
named | red, blue |
hex | #2563eb |
rgb/hsl | rgb(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
Official study links
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 / concept | Meaning / usage |
|---|---|
transparent | default in many cases |
solid | #fff, rgb(), hsl() |
token | var(--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
Official study links
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 / concept | Meaning / usage |
|---|---|
0 | fully transparent |
0.5 | half transparent |
1 | fully 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
Official study links
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 / concept | Meaning / usage |
|---|---|
use with | border-color, fill, stroke, outline-color |
benefit | theme-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
Official study links
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 / concept | Meaning / usage |
|---|---|
applies to | checkbox, radio, range, progress |
best | brand-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
Official study links
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 / concept | Meaning / usage |
|---|---|
#RGB | short form |
#RRGGBB | standard |
#RRGGBBAA | with 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
Official study links
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 / concept | Meaning / usage |
|---|---|
rgb | red green blue |
alpha | transparency |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
hue | 0-360 degrees |
saturation | color intensity |
lightness | brightness |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
high contrast | better readability |
test | use 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
Official study links
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 / concept | Meaning / usage |
|---|---|
shorthand | background combines multiple background properties |
layers | comma-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
Official study links
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 / concept | Meaning / usage |
|---|---|
image | url(...) |
gradient | linear-gradient(...), radial-gradient(...) |
none | no 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
Official study links
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 / concept | Meaning / usage |
|---|---|
cover | fills, may crop |
contain | fits, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
keywords | center, top, bottom, left, right |
lengths | 20px 40px |
percent | 50% 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
Official study links
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 / concept | Meaning / usage |
|---|---|
repeat | tiles both directions |
repeat-x | horizontal |
repeat-y | vertical |
no-repeat | single 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
Official study links
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 / concept | Meaning / usage |
|---|---|
scroll | default |
fixed | fixed to viewport |
local | scrolls 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
Official study links
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 / concept | Meaning / usage |
|---|---|
border-box | under border |
padding-box | inside border |
content-box | content only |
text | clip 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
Official study links
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 / concept | Meaning / usage |
|---|---|
border-box | from border edge |
padding-box | from padding edge |
content-box | from 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | no blend |
multiply | darkens |
screen | lightens |
overlay | contrast 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
Official study links
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 / concept | Meaning / usage |
|---|---|
content-box | default, width excludes padding/border |
border-box | width 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | browser calculates |
px/rem/% | fixed or fluid |
fit-content | shrink 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | height based on content |
px/rem/vh | fixed 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
percentage | relative to parent |
0 | allow 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
Official study links
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 / concept | Meaning / usage |
|---|---|
none | default |
length | fixed 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
viewport | vh/dvh |
auto | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
none | default |
length | fixed maximum |
percentage | depends 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
Official study links
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 / concept | Meaning / usage |
|---|---|
single | all sides |
two values | vertical horizontal |
four values | top right bottom left |
auto | automatic 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
percentage | relative to width in many cases |
auto | context-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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
auto | can 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
0 | remove 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | can push/center |
length | px/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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | center block with width |
length | both 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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | both block sides |
two values | start 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
Official study links
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 / concept | Meaning / usage |
|---|---|
single | all sides |
two values | vertical horizontal |
four values | top 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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | both inline sides |
two values | start/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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | both block sides |
two values | start/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
Official study links
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 / concept | Meaning / usage |
|---|---|
width | 1px |
style | solid/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
Official study links
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 / concept | Meaning / usage |
|---|---|
thin/medium/thick | keywords |
length | px/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
Official study links
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 / concept | Meaning / usage |
|---|---|
solid | normal line |
dashed | dashes |
dotted | dots |
none | no 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
Official study links
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 / concept | Meaning / usage |
|---|---|
color | any CSS color |
currentColor | match 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
percent | 50% for circles/avatars |
per corner | four 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
Official study links
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 / concept | Meaning / usage |
|---|---|
style | solid/auto |
offset | use outline-offset |
color | accessible 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
Official study links
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 / concept | Meaning / usage |
|---|---|
positive | away from element |
negative | inside |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
offset-x | horizontal offset |
offset-y | vertical offset |
blur | softness |
spread | size |
inset | inside 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
Official study links
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 / concept | Meaning / usage |
|---|---|
ratio | 1 / 1, 16 / 9, 4 / 3 |
works with | auto 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
Official study links
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 / concept | Meaning / usage |
|---|---|
generic | serif, sans-serif, monospace |
custom | loaded 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
Official study links
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 / concept | Meaning / usage |
|---|---|
absolute | px |
relative | rem/em |
fluid | clamp(...) |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | 400 |
bold | 700 |
numeric | 100-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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | default |
italic | italic style |
oblique | slanted 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
Official study links
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 / concept | Meaning / usage |
|---|---|
unitless | recommended for body text |
length | fixed |
percentage | relative |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
positive | more space |
negative | tighter 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | default |
length | extra 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
Official study links
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 / concept | Meaning / usage |
|---|---|
start/end | logical |
left/right | physical |
center | centered |
justify | spread 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
Official study links
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 / concept | Meaning / usage |
|---|---|
underline | line below |
line-through | deleted |
none | remove |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
color | any CSS color |
currentColor | matches 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | default |
from-font | font-defined |
length | fixed |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/em/rem |
auto | browser 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
Official study links
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 / concept | Meaning / usage |
|---|---|
uppercase | ALL CAPS |
lowercase | lowercase |
capitalize | Each 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/em |
percentage | relative 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
Official study links
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 / concept | Meaning / usage |
|---|---|
offset | x/y |
blur | softness |
color | shadow 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | collapse spaces |
nowrap | single line |
pre | preserve |
pre-wrap | preserve 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | do not break words |
break-word | break long words |
anywhere | more 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | default |
break-all | break any character |
keep-all | CJK 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
Official study links
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 / concept | Meaning / usage |
|---|---|
clip | cut off |
ellipsis | show ... |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
ltr | left-to-right |
rtl | right-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
Official study links
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 / concept | Meaning / usage |
|---|---|
horizontal-tb | normal |
vertical-rl | vertical right-left |
vertical-lr | vertical 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
font-family | custom name |
src | font file |
font-display | loading 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
Official study links
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 / concept | Meaning / usage |
|---|---|
block | new line, full width |
inline | within line |
inline-block | inline but sizeable |
flex | flex layout |
grid | grid layout |
none | removed 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
Official study links
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 / concept | Meaning / usage |
|---|---|
visible | shown |
hidden | invisible but space remains |
collapse | table-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
Official study links
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 / concept | Meaning / usage |
|---|---|
static | normal flow |
relative | offset from own position |
absolute | positioned to ancestor |
fixed | viewport |
sticky | sticks 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
percentage | relative to containing block |
auto | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
auto | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
auto | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
auto | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | all sides |
two/four values | like 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | default |
integer | stacking level |
context | only 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
Official study links
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 / concept | Meaning / usage |
|---|---|
visible | default |
hidden | clip |
auto | scroll if needed |
scroll | always 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
Official study links
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 / concept | Meaning / usage |
|---|---|
hidden | clip horizontal |
auto | horizontal 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
Official study links
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 / concept | Meaning / usage |
|---|---|
hidden | clip vertical |
auto | vertical 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
Official study links
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 / concept | Meaning / usage |
|---|---|
left | float left |
right | float right |
none | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
left | clear left floats |
right | clear right floats |
both | clear 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
Official study links
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 / concept | Meaning / usage |
|---|---|
fill | stretch |
contain | fit all |
cover | fill and crop |
none | original size |
scale-down | smaller 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
Official study links
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 / concept | Meaning / usage |
|---|---|
keywords | center top |
percent | 50% 50% |
length | 10px 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | default |
isolate | creates 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
Official study links
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 / concept | Meaning / usage |
|---|---|
layout | layout containment |
paint | paint containment |
size | size containment |
content | common 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
Official study links
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 / concept | Meaning / usage |
|---|---|
container | parent with display:flex |
items | direct 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
Official study links
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 / concept | Meaning / usage |
|---|---|
row | left to right in LTR |
row-reverse | reverse row |
column | top to bottom |
column-reverse | reverse 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
Official study links
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 / concept | Meaning / usage |
|---|---|
nowrap | single line |
wrap | multiple lines |
wrap-reverse | reverse 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
Official study links
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 / concept | Meaning / usage |
|---|---|
first | flex-direction |
second | flex-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
Official study links
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 / concept | Meaning / usage |
|---|---|
flex-start | start |
center | center |
space-between | spread edges |
space-around | space around |
space-evenly | equal 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
Official study links
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 / concept | Meaning / usage |
|---|---|
stretch | default |
flex-start | start |
center | center |
flex-end | end |
baseline | text 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
Official study links
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 / concept | Meaning / usage |
|---|---|
stretch | default |
center | center lines |
space-between | distribute 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
Official study links
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 / concept | Meaning / usage |
|---|---|
row-gap | vertical gap |
column-gap | horizontal gap |
gap | both |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
percentage | context-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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | px/rem |
normal | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
grow | first value |
shrink | second value |
basis | third 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
Official study links
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 / concept | Meaning / usage |
|---|---|
0 | do 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
Official study links
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 / concept | Meaning / usage |
|---|---|
0 | do not shrink |
1 | default 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | content/width based |
length | fixed starting size |
0 | distribute 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | use parent align-items |
center | center item |
stretch | stretch 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
Official study links
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 / concept | Meaning / usage |
|---|---|
default | 0 |
negative | comes earlier |
positive | comes 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
Official study links
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 / concept | Meaning / usage |
|---|---|
grid | block grid container |
inline-grid | inline 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | fixed columns |
fr | flexible columns |
repeat | repeat pattern |
minmax | range |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | content-sized |
fr | flexible |
length | fixed |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
area names | assigned by grid-area |
dot | empty 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
Official study links
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 / concept | Meaning / usage |
|---|---|
name | named area |
line syntax | row-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
Official study links
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 / concept | Meaning / usage |
|---|---|
span | span tracks |
1 / 3 | line 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
Official study links
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 / concept | Meaning / usage |
|---|---|
span | span tracks |
1 / 4 | line 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
Official study links
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 / concept | Meaning / usage |
|---|---|
row | fill rows |
column | fill columns |
dense | backfill 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | fixed implicit columns |
fr | flexible |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | content |
length | fixed |
minmax | range |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
stretch | default |
start | start |
center | center |
end | end |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
stretch | default |
start | top |
center | middle |
end | bottom |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | both axes |
two values | align 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
Official study links
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 / concept | Meaning / usage |
|---|---|
start | left/start |
center | center |
space-between | distribute 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
Official study links
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 / concept | Meaning / usage |
|---|---|
start | top |
center | middle |
space-between | distribute 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
Official study links
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 / concept | Meaning / usage |
|---|---|
one value | both axes |
two values | align 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
Official study links
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 / concept | Meaning / usage |
|---|---|
fixed count | repeat(3, 1fr) |
auto-fit | responsive tracks |
auto-fill | fill 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
Official study links
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 / concept | Meaning / usage |
|---|---|
min | minimum track |
max | maximum 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
Official study links
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 / concept | Meaning / usage |
|---|---|
behavior | fit existing items |
best for | responsive 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
Official study links
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 / concept | Meaning / usage |
|---|---|
behavior | fill with tracks |
difference | does 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | nested alignment |
support | modern 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
Official study links
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 / concept | Meaning / usage |
|---|---|
mobile-first | start small, enhance larger |
desktop-first | start 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
min-width | mobile-first |
max-width | desktop-first |
print | print 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | mobile-first CSS |
benefit | fewer 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | small-screen exceptions |
caution | overrides 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
Official study links
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 / concept | Meaning / usage |
|---|---|
portrait | height >= width often |
landscape | width > 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
Official study links
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 / concept | Meaning / usage |
|---|---|
hover | can hover |
none | no 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
Official study links
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 / concept | Meaning / usage |
|---|---|
coarse | finger/touch |
fine | mouse/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
Official study links
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 / concept | Meaning / usage |
|---|---|
dark | dark preference |
light | light 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
Official study links
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 / concept | Meaning / usage |
|---|---|
reduce | minimize motion |
no-preference | normal |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
container-type | enables querying |
best for | reusable 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
Official study links
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 / concept | Meaning / usage |
|---|---|
inline-size | query width/inline axis |
size | query 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
Official study links
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 / concept | Meaning / usage |
|---|---|
name | identifier for @container |
use | specific 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
Official study links
@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 / concept | Meaning / 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
Official study links
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 / concept | Meaning / usage |
|---|---|
use for | reports, invoices, certificates |
check | print 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
Official study links
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 / concept | Meaning / usage |
|---|---|
max-width | prevent overflow |
height auto | preserve 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
Official study links
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 / concept | Meaning / usage |
|---|---|
property | what changes |
duration | how long |
timing | easing |
delay | wait 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
Official study links
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 / concept | Meaning / usage |
|---|---|
specific | transform, opacity |
all | every 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
Official study links
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 / concept | Meaning / usage |
|---|---|
ms | milliseconds |
s | seconds |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
ease | default-ish smooth |
linear | constant |
ease-in/out | accelerate/decelerate |
cubic-bezier | custom |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
0s | no delay |
positive | starts 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
Official study links
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 / concept | Meaning / usage |
|---|---|
translate | move |
scale | resize visually |
rotate | turn |
skew | slant |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
x y | 2D movement |
z | 3D 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
Official study links
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 / concept | Meaning / usage |
|---|---|
1 | normal |
>1 | larger |
<1 | smaller |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
deg | degrees |
turn | turns |
rad | radians |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
x/y | skew axes |
caution | can 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
Official study links
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 / concept | Meaning / usage |
|---|---|
keywords | center, top right |
percent | 50% 50% |
length | 10px 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
Official study links
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 / concept | Meaning / usage |
|---|---|
name | keyframes name |
duration | time |
timing | easing |
fill | before/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
Official study links
@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 / concept | Meaning / usage |
|---|---|
from/to | Shortcut for 0% and 100% animation states |
percentages | Use 0%, 50%, 100% for multiple stages |
animation-name | Must 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
Official study links
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 / concept | Meaning / usage |
|---|---|
none | no animation |
custom name | matches @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
Official study links
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 / concept | Meaning / usage |
|---|---|
ms/s | time values |
required | without 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
Official study links
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 / concept | Meaning / usage |
|---|---|
ease | smooth |
linear | constant |
steps() | stepped |
cubic-bezier | custom |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
positive | wait |
negative | start 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
Official study links
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 / concept | Meaning / usage |
|---|---|
number | 1,2,3 |
infinite | loops 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | forward |
reverse | backward |
alternate | forward 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
Official study links
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 / concept | Meaning / usage |
|---|---|
none | default |
forwards | keep final styles |
backwards | apply first keyframe before start |
both | both |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
running | active |
paused | stopped 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
Official study links
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 / concept | Meaning / 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
Official study links
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 / concept | Meaning / usage |
|---|---|
blur | glass effect |
brightness | backdrop lighting |
support | test 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
Official study links
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 / concept | Meaning / usage |
|---|---|
normal | default |
multiply | darken |
screen | lighten |
difference | contrast 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | browser decides |
pointer | clickable |
not-allowed | disabled |
text | text 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | normal |
none | ignore 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | default |
text | selectable |
none | not selectable |
all | select 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | browser default |
color | custom 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
Official study links
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 / concept | Meaning / usage |
|---|---|
none | disable |
both | both directions |
vertical | height only |
horizontal | width 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | native |
none | remove 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
Official study links
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 / concept | Meaning / usage |
|---|---|
use with | select, input, button |
caution | rebuild 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
Official study links
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 / concept | Meaning / usage |
|---|---|
selector | input::placeholder |
avoid | placeholder-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
Official study links
: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 / concept | Meaning / usage |
|---|---|
selector | :disabled |
use | buttons/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
Official study links
: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 / concept | Meaning / usage |
|---|---|
selector | :invalid |
caution | may 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
Official study links
: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 / concept | Meaning / usage |
|---|---|
selector | :valid |
use | form 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
Official study links
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 / concept | Meaning / usage |
|---|---|
selector | :focus-visible |
must have | visible 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
Official study links
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 / concept | Meaning / usage |
|---|---|
disc/circle/square | unordered |
decimal/lower-alpha | ordered |
none | remove 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
Official study links
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 / concept | Meaning / usage |
|---|---|
outside | marker outside |
inside | marker 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
Official study links
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 / concept | Meaning / usage |
|---|---|
url | custom image |
none | default |
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
Official study links
::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 / concept | Meaning / usage |
|---|---|
properties | color, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
separate | default separated borders |
collapse | shared 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | horizontal 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
Official study links
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 / concept | Meaning / usage |
|---|---|
top | above table |
bottom | below 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
Official study links
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 / concept | Meaning / usage |
|---|---|
show | display empty cells |
hide | hide 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
Official study links
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 / concept | Meaning / usage |
|---|---|
baseline | default |
middle | center-ish |
top/bottom | edges |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | instant |
smooth | animated 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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | space around target |
logical | scroll-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
Official study links
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 / concept | Meaning / usage |
|---|---|
length | safe scroll inset |
container | scroll 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
Official study links
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 / concept | Meaning / usage |
|---|---|
x/y/both | axis |
mandatory/proximity | strictness |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
start | align start |
center | align center |
end | align 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
Official study links
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 / concept | Meaning / usage |
|---|---|
auto | default |
contain | stop chaining |
none | also 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
position | must 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
common use | XML/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
Official study links
@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 / concept | Meaning / usage |
|---|---|
must be early | before most style rules |
performance | can 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
order matters | declared layer order |
use | architecture |
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
Official study links
@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 / concept | Meaning / usage |
|---|---|
use | component scoping |
support | check 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
Official study links
@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 / concept | Meaning / usage |
|---|---|
syntax | type of custom property |
inherits | true/false |
initial-value | default |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | consistent baseline |
caution | do 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
Official study links
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 / concept | Meaning / usage |
|---|---|
purpose | preserve defaults |
common | form 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
Official study links
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 / concept | Meaning / usage |
|---|---|
examples | color, spacing, font, radius |
benefit | consistency |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
block | component |
element | part |
modifier | variation |
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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | spacing, text alignment, visibility |
caution | too 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
Official study links
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 / concept | Meaning / usage |
|---|---|
component | reusable UI block |
goal | isolation 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
Official study links
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 / concept | Meaning / usage |
|---|---|
small project | single file okay |
large project | separate 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
Official study links
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 / concept | Meaning / usage |
|---|---|
good | semantic component names |
avoid | purely 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
Official study links
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 / concept | Meaning / usage |
|---|---|
best for | dark mode and branding |
scope | can 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
Official study links
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 / concept | Meaning / usage |
|---|---|
automatic | prefers-color-scheme |
manual | data-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
Official study links
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 / concept | Meaning / usage |
|---|---|
must check | focus, contrast, zoom, motion |
avoid | display: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
Official study links
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 / concept | Meaning / usage |
|---|---|
animate | transform and opacity |
avoid | layout-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
Official study links
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 / concept | Meaning / usage |
|---|---|
tools | Elements, Styles, Computed, Layout |
strategy | isolate 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
Official study links
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 / concept | Meaning / usage |
|---|---|
strategy | fallbacks |
test | Chrome, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
SEO impact | UX, mobile, performance |
avoid | hidden 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
Official study links
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 / concept | Meaning / usage |
|---|---|
use for | certificates, invoices, reports |
test | print 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
Official study links
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 / concept | Meaning / usage |
|---|---|
quality areas | responsive, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
concepts | grid, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
concepts | flex, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
concepts | grid 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
Official study links
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 / concept | Meaning / usage |
|---|---|
concepts | font 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
Official study links
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 / concept | Meaning / usage |
|---|---|
concepts | tokens, 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
Official study links
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 / concept | Meaning / usage |
|---|---|
MDN | Reference and browser compatibility |
W3C | Specifications |
W3Schools | Beginner examples and exercises |
DevTools | Debugging 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.