CSS Roadmap
CSS controls how every web page looks and adapts: colour, type, spacing, layout, animation and the way a design responds to phones, large screens and user preferences. Front-end, full-stack and design engineering roles all depend on it, and interviews test it with live layout tasks and questions about the cascade.
CSS has a reputation for being unpredictable. It is not, once you understand three ideas: the cascade decides which rule wins, the box model decides how big things are, and layout modes decide where things go. This roadmap builds those foundations first, then covers typography, positioning, flexbox, grid, responsive design, motion, accessibility, performance and the tools teams use to organise large stylesheets.
Each topic explains the idea in plain terms, shows a short example and gives you an exercise. Modern CSS has changed a lot in recent years, with custom properties, container queries, :has(), cascade layers and native nesting, so this roadmap teaches the current way and points out older techniques you will still meet in existing code.
- Level
- Beginner to advanced
- Time
- 8–12 weeks at about 6 hours a week
- Scope
- 53 topics in 10 stages
- Before you start
- Basic HTML Roadmap: document structure, common elements, classes and ids; A code editor and a modern browser with DevTools
What you will be able to do
- Predict which rule wins on any element using the cascade, specificity and layers.
- Size and space elements precisely with the box model and suitable units.
- Build any common layout with flexbox and grid, and explain which fits when.
- Make pages responsive with fluid sizes, media queries and container queries.
- Add transitions and animations that are smooth and respect user preferences.
- Write accessible, fast CSS and organise it for a large codebase.
The roadmap at a glance
- Stage 1CSS BasicsBeginner · 3–5 days · 3 topics
- Stage 2SelectorsBeginner · 1 week · 5 topics
- Stage 3The Cascade, Specificity and InheritanceBeginner · 1 week · 4 topics
- Stage 4Box Model, Units, Colour and VariablesBeginner · 1–2 weeks · 8 topics
- Stage 5Typography, Backgrounds and ImagesBeginner · 1–2 weeks · 9 topics
- Stage 6Layout Fundamentals: Display, Position and StackingIntermediate · 1–2 weeks · 5 topics
- Stage 7Modern Layout: Flexbox, Grid and ColumnsIntermediate · 2–3 weeks · 5 topics
- Stage 8Responsive DesignIntermediate · 1–2 weeks · 4 topics
- Stage 9Motion, Accessibility and PerformanceAdvanced · 1–2 weeks · 5 topics
- Stage 10Architecture and ToolingAdvanced · 1–2 weeks · 5 topics
Stage 1 CSS Basics
Goal. Write and attach stylesheets and read any CSS rule with confidence.
CSS Basics: What CSS Does Core
CSS (Cascading Style Sheets) decides how HTML content is presented: colours, fonts, spacing, layout, animation and how all of that adapts to screen size. HTML says what each piece of content is; CSS says how it should look. JavaScript adds behaviour on top.
That split is the heart of frontend development. One HTML document can be restyled completely by swapping its stylesheet, and one stylesheet can style hundreds of pages.
The word "cascading" matters. Several rules can target the same element, from your files, from the browser's defaults and sometimes from the user. The cascade is the algorithm that decides which value wins. Most CSS confusion comes from not knowing that algorithm, so this roadmap covers it early. Learn HTML Roadmap at the same time if you have not yet.
Practice. Open DevTools on any site, select an element and change three of its styles live in the Styles panel.
CSS Rules: Selector, Declaration, Properties and Values Core
A stylesheet is a list of CSS rules. Each rule has a selector, which picks elements, and a block of declarations. A declaration is a property and a value separated by a colon and ended with a semicolon.
/* Cards on the pricing page */
.card {
padding: 1rem;
border-radius: 8px;
}So in padding: 1rem, padding is the property and 1rem the value. Properties and values are case-insensitive, but write them in lowercase. Comments use /* … */; there is no single-line // comment in plain CSS.
Invalid declarations are skipped silently instead of breaking the stylesheet. That is forgiving, but it also means typos fail quietly. DevTools shows ignored declarations struck through with a warning icon, so check there first when a style "does nothing".
Some rules start with @, such as @media, @import, @font-face and @keyframes. These are at-rules, and they control conditions, imports and definitions rather than styling elements directly.
Practice. Write five rules from memory and label the selector, property and value in each.
Inline CSS, Internal CSS and External CSS Core
CSS reaches a page in three ways.
- External CSS: a
.cssfile linked with<link rel="stylesheet" href="site.css">. This is the normal choice: reusable, cacheable and easy to maintain. - Internal CSS: a
<style>block in thehead. Good for demos, emails and small amounts of critical CSS inlined for speed. - Inline CSS: a
styleattribute on one element. It beats normal selectors in the cascade, cannot express hover states or media queries, and spreads styling across markup. Use it mostly for values set by JavaScript.
Avoid @import inside CSS files for loading other files; it makes downloads happen one after another. Use several link elements or a build tool that bundles files instead.
Practice. Style one heading three ways at once and use DevTools to see which rule wins and why.
Stage 2 Selectors
Goal. Target exactly the elements you mean, using simple, attribute, combinator and pseudo selectors.
Simple Selectors: Element, Class, ID, Universal and Grouping Core
Simple selectors match elements by one feature.
- Element selectors such as
porbuttonmatch by tag name. - Class selectors such as
.cardmatch by class. They are the workhorse of maintainable CSS. - ID selectors such as
#headermatch one element. Their high specificity makes them hard to override, so most teams avoid them for styling. - The universal selector
*matches everything; it is often used forbox-sizingresets.
Grouping selectors with commas applies one block to several selectors:
h1, h2, h3 { line-height: 1.2; }
button.primary { background: navy; }Writing selectors together without a space, like button.primary, means both must match on the same element. That small detail of spacing changes meaning, a common source of bugs.
Practice. Style a page using only class selectors, then explain where an element or universal selector would be simpler.
Attribute Selectors Recommended
Attribute selectors match elements by the presence or value of an attribute.
[disabled] { opacity: 0.5; }
input[type="email"] { width: 100%; }
a[href^="mailto:"] { text-decoration: none; }
a[href$=".pdf"]::after { content: " (PDF)"; }
[class*="icon-"] { display: inline-block; }^= means "starts with", $= "ends with" and *= "contains". Adding i before the closing bracket makes the match case-insensitive.
They are useful for styling by state that the HTML already expresses, such as [aria-expanded="true"] or [data-variant="danger"]. That keeps styles in sync with accessibility attributes instead of duplicating state in extra classes.
Practice. Add an icon after every external link and every PDF link using only attribute selectors.
Combinator Selectors Core
Combinator selectors match elements by their relationship to others.
- The descendant combinator (a space):
nav amatches anyainside anav, however deep. - The child combinator
>:ul > limatches only direct children. - The next sibling combinator
+:h2 + pmatches a paragraph immediately after anh2. - The subsequent sibling combinator
~:h2 ~ pmatches every later sibling paragraph.
.menu > li { display: inline-block; }
label + input { margin-top: 0.25rem; }Long descendant chains like .page .sidebar ul li a are fragile: they break when markup changes and raise specificity. Prefer one meaningful class on the element you want to style.
Practice. Write a selector for each combinator against a small article page and predict the matches before checking.
Pseudo-Classes Core
Pseudo-classes match elements in a particular state or position. They start with one colon.
- User interaction:
:hover,:active,:focus,:focus-visible(focus from the keyboard, the right hook for focus rings). - Form state:
:checked,:disabled,:required,:invalid,:user-invalid,:placeholder-shown. - Structure:
:first-child,:last-child,:nth-child(2n),:not(.active). - Logic:
:is()and:where()group selectors;:where()adds zero specificity. :has()matches a parent based on what it contains, now supported in all major browsers.
.card:has(img) { padding-top: 0; }
li:nth-child(odd) { background: #f6f6f6; }:has() replaces many JavaScript tricks that used to add classes to parents.
Practice. Style a form so that invalid fields turn red only after the user has interacted with them.
Pseudo-Elements Core
Pseudo-elements style a part of an element, or add a box that is not in the HTML. They use two colons.
::beforeand::afterinsert generated content and need acontentproperty, even if empty.::first-lineand::first-letterstyle parts of text.::placeholder,::selectionand::markerstyle input hints, selected text and list bullets.::backdropstyles the layer behind a modal dialog.
.required::after { content: " *"; color: crimson; }
li::marker { color: teal; }Generated content is decoration. Screen readers may or may not read it, and users cannot select it, so never put essential information there.
Practice. Build a quotation style that adds large decorative quote marks with ::before and ::after.
Stage 3 The Cascade, Specificity and Inheritance
Goal. Predict which rule wins on any element and fix conflicts without reaching for !important.
Cascading Order Core
When several declarations set the same property on the same element, the cascade picks one by checking, in this cascading order:
- Origin and importance: browser defaults, then user styles, then author styles (yours). Declarations marked
!importantreverse that order. - Cascade layers, if you use
@layer. - Specificity of the selector.
- Order of appearance: the last declaration wins.
Inline style attributes beat any selector in your stylesheets unless !important is used. Animations and transitions also take part in the cascade.
Most "my style is ignored" bugs come from specificity or order. In DevTools, the Styles panel lists rules in winning order and crosses out the losers; the Computed tab shows the final value and where it came from.
Practice. Create a conflict between three rules and predict the winner before checking in DevTools.
CSS Specificity Core
CSS specificity is a score for each selector, written as three numbers (ids, classes, elements).
- Each id adds to the first number.
- Each class, attribute selector or pseudo-class adds to the second.
- Each element or pseudo-element adds to the third.
*, combinators and:where()add nothing;:is(),:not()and:has()take the specificity of their most specific argument.
So #nav a scores 1-0-1, and .menu .item a:hover scores 0-3-1. The id wins regardless of how many classes are on the other side; columns never overflow into each other.
Keep specificity low and flat: mostly single classes. When you find yourself writing !important to win, the real fix is to lower the specificity of the rule you are fighting.
Practice. Calculate the specificity of ten selectors from a real stylesheet and rank them.
Inheritance and Global Values Core
Some properties are inherited: children receive the parent's value unless they set their own. Most text properties inherit, such as color, font-family, font-size and line-height. Most box properties do not, such as margin, padding, border and width.
That is why setting font-family once on body styles the whole page. Form controls are an exception: browsers give them their own fonts, so add font: inherit to them.
Every property also accepts global keywords:
inherittakes the parent's value.initialuses the property's default from the specification.unsetbehaves asinheritfor inherited properties andinitialfor others.revertgoes back to the browser's default style.
Practice. Set fonts and colours once on body, then find which elements did not inherit them and explain why.
Cascade Layers Recommended
Cascade layers, created with @layer, give you explicit control over priority before specificity is even considered. A rule in a later layer beats a rule in an earlier layer regardless of selector strength.
@layer reset, base, components, utilities;
@layer base { a { color: navy; } }
@layer utilities { .text-red { color: crimson; } }This solves an old problem: third-party CSS or a reset with heavy selectors that you had to override with ever stronger selectors. Put vendor styles in an early layer and your own in later ones. Unlayered styles beat all layered ones, which surprises people the first time. Layers are supported in all current browsers.
Practice. Put a third-party stylesheet in a low layer with @import ... layer(vendor) and override it with a single class.
Stage 4 Box Model, Units, Colour and Variables
Goal. Size and space elements precisely, choose units deliberately and manage colour with custom properties.
Box Model Core
Every element is drawn as a rectangular box made of four layers, from inside out: content, padding, border and margin. The box model describes how these add up.
By default (box-sizing: content-box), width sets only the content area, so padding and border make the box wider than you asked. Nearly every project switches to border-box, where width includes padding and border:
*, *::before, *::after { box-sizing: border-box; }Outline and box shadows do not take up space in the box model. DevTools shows a diagram of every element's box, which is the fastest way to see where unexpected space comes from.
Practice. Give a box a width, padding and border, then compare its rendered size under both box-sizing values.
Margin, Padding and Border Core
Padding is space inside the border and shows the background. Margin is space outside the border and is transparent. A border sits between them and has a width, style and colour.
.card {
padding: 1rem 1.5rem; /* vertical horizontal */
border: 1px solid #ccc;
border-radius: 8px;
margin-block-end: 2rem;
}Shorthands take one to four values going clockwise from the top. Margins can be negative and can be auto, which is how a block with a width is centred horizontally.
Vertical margins between blocks in normal flow collapse: two adjacent margins of 20px and 30px give a 30px gap, not 50px. Margins also collapse through a parent with no padding or border. Flex and grid items never collapse margins, and modern layouts often use gap instead.
Practice. Recreate a margin-collapse bug between two sections, then fix it two different ways.
Width and Height Core
Block elements take the full width of their container by default; height grows with content. Setting fixed heights on boxes that hold text is a common source of overflow bugs, so let height follow content where you can.
Useful tools:
max-widthkeeps content readable on large screens:max-width: 65chfor text.min-heightsets a floor without capping growth.aspect-ratio: 16 / 9keeps a box's proportions.overflowcontrols what happens when content does not fit:visible,hidden,scrollorauto.- Intrinsic keywords such as
min-content,max-contentandfit-contentsize by content.
Inline elements ignore width and height; change their display first. Logical properties such as inline-size and block-size follow writing direction.
Practice. Build a video card that keeps a 16:9 ratio at any width and a text column that never exceeds 65 characters.
CSS Units: Absolute vs. Relative Units Core
CSS units fall into two groups. The choice of absolute vs. relative units affects accessibility and responsiveness.
Absolute units have a fixed size: px is the common one (a CSS pixel, not a device pixel); cm, in and pt suit print.
Relative units scale with something else:
em: the current element's font size.rem: the root font size. Use it for font sizes and most spacing so text respects the user's browser settings.%: a share of the parent, depending on the property.vw,vh: a share of the viewport. On phones,dvh,svhandlvhhandle the browser bar that shows and hides.ch: the width of the "0" character, handy for line lengths.fr: a share of free space in grid.
A reasonable default: rem for type and spacing, px for borders, % and fr for layout.
Practice. Change your browser default font size to 20px and see which parts of your page scale and which do not.
CSS Functions and Units with Functions Core
CSS has many functions. The ones you will use constantly do maths with units with functions:
calc()mixes units:width: calc(100% - 2rem).min()andmax()pick the smaller or larger value:width: min(100%, 60rem).clamp(min, preferred, max)keeps a fluid value within bounds.
.container { width: min(100% - 2rem, 70rem); margin-inline: auto; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem); }Other common CSS functions include var() for custom properties, url() for images, colour functions like rgb() and hsl(), repeat() and minmax() in grid, and transform functions such as translate(). These functions often remove the need for several media queries.
Practice. Build a centred container that is full-width on phones with a 1rem gutter and capped on large screens, using one declaration.
Color Core
The color property sets text colour; background-color, border-color and others set the rest. CSS uses the American spelling in property names, and its documentation describes several formats.
- Named colors: keywords such as
navy,tomatoandtransparent. - Hex colors:
#1e90ff, with an optional alpha pair,#1e90ff80. - RGB colors in CSS:
rgb(30 144 255), red, green and blue from 0 to 255. - HSL colors:
hsl(210 100% 56%), hue, saturation and lightness, easier to tweak by hand. - rgba and hsla colors: the older names for the alpha forms. Modern syntax adds alpha with a slash,
rgb(30 144 255 / 50%), and the old comma syntax still works.
Newer functions such as oklch() give more even lightness across hues, which helps design systems. currentColor reuses the text colour. Always check text contrast; WCAG asks for at least 4.5:1 for normal text.
Practice. Define a five-colour palette in HSL and check every text and background pairing with a contrast checker.
Opacity, Outline and Box Shadows Recommended
Opacity makes a whole element, including its children, transparent: opacity: 0.6. To fade only a background, use a colour with alpha instead. Opacity below 1 also creates a new stacking context, which matters for z-index.
An outline is drawn outside the border and takes no space. Browsers use it for focus rings. Never remove it without a visible replacement; style it instead:
:focus-visible { outline: 3px solid #1e90ff; outline-offset: 2px; }
.card { box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); }Box shadows take horizontal and vertical offsets, blur, optional spread and a colour, and can be stacked with commas. inset draws the shadow inside. Large blurred shadows on many elements can slow scrolling on weak devices.
Practice. Design a focus style and a card hover shadow that both look clear on light and dark backgrounds.
CSS Variables Core
CSS variables, officially custom properties, store values you reuse. They start with two dashes and are read with var().
:root {
--brand: hsl(210 90% 45%);
--space: 1rem;
}
.button { background: var(--brand); padding: var(--space); }
.dark { --brand: hsl(210 90% 65%); }Unlike Sass variables, they are live in the browser: they cascade, inherit and can change per element, per media query or from JavaScript with style.setProperty. That makes them the standard tool for theming and dark mode. var(--x, fallback) supplies a default. @property can register a type for a variable so it can be animated.
Practice. Build a light and dark theme for a page by redefining only custom properties.
Stage 5 Typography, Backgrounds and Images
Goal. Set readable, well-loaded type and use backgrounds and images that adapt to their boxes.
Font Families and Google Fonts Core
font-family takes a list of fonts in order of preference, ending with a generic family such as serif, sans-serif, monospace or system-ui. The browser uses the first one available.
Custom fonts load with @font-face. Services such as Google Fonts host thousands of free fonts and give you a stylesheet link, but self-hosting the files is often faster and avoids a third-party request.
@font-face {
font-family: "Inter";
src: url("/fonts/inter.woff2") format("woff2");
font-display: swap;
}
body { font-family: "Inter", system-ui, sans-serif; }Use WOFF2, load only the weights you need, and set font-display: swap so text shows in a fallback font while the custom one loads. Variable fonts pack many weights in one file.
Practice. Self-host one font in two weights and measure how many bytes it adds to the page.
Font Size, Font Weight, Font Style and Font Variant Core
- Font size: set it in
remso it respects the user's preference. Body text around1remto1.125remreads well. - Font weight:
400is normal and700bold. Only weights the font provides look right; others are faked. - Font style:
normaloritalic. - Font variant: features such as
small-capsand, throughfont-variant-numeric, tabular numbers that line up in tables.
The font shorthand sets several properties at once, but it resets any you leave out, including line-height:
body { font: 400 1rem/1.6 "Inter", system-ui, sans-serif; }Size and family are required in the shorthand. Use it carefully or stick to the longhand properties.
Practice. Set up a type scale of five sizes in rem and apply it to headings, body text and captions.
Line Height and Text Spacing Core
Line height controls the space between lines. Use a unitless number such as 1.5: it multiplies each element's own font size, while a unit value like 24px is inherited as a fixed amount and breaks on larger text. Body text reads well at about 1.5; headings need less.
Text spacing covers more properties:
letter-spacingadjusts space between characters, helpful for small caps and uppercase labels.word-spacingadjusts space between words.text-indentindents the first line.white-spacecontrols wrapping and whether spaces collapse.
WCAG requires that content still works when users increase line height and letter spacing, so avoid fixed heights on text containers.
Practice. Apply the WCAG text spacing overrides to a page with a bookmarklet and fix anything that overlaps or clips.
Text Styling: Alignment, Decoration, Transform and Shadows Core
Common text styling properties:
- Text alignment with
text-align:start,end,centerorjustify. Justified text creates uneven gaps on narrow screens. - Text decoration: underline, overline or line-through, with
text-decoration-thicknessandtext-underline-offsetfor nicer links. - Text transform:
uppercase,lowercaseorcapitalize. Use it instead of typing capitals in the HTML, so screen readers do not spell words out. - Text shadows:
text-shadow: 0 1px 2px rgb(0 0 0 / 0.4)can lift text over images. text-overflow: ellipsiswithoverflow: hiddenandwhite-space: nowraptruncates one line;line-clamphandles several.text-wrap: balanceevens out heading lines in current browsers.
Practice. Style a blog post with underlined links, uppercase labels, balanced headings and an excerpt clamped to three lines.
Direction, Writing Modes and Logical Properties Recommended
Not every language runs left to right. Arabic and Hebrew run right to left, set in HTML with dir="rtl" and reflected in the CSS direction property. Some languages can run vertically with writing-mode.
Logical properties describe space by flow instead of physical side:
margin-inline-startinstead ofmargin-left.padding-blockfor top and bottom.inset-inline-endinstead ofright.inline-sizeandblock-sizeinstead of width and height.
.alert { border-inline-start: 4px solid orange; padding-inline: 1rem; }With logical properties, a layout flips correctly when the page switches to right to left, with no extra CSS. Prefer setting direction in HTML rather than CSS, because it is part of the content's meaning.
Practice. Convert a component to logical properties and check it renders correctly with dir="rtl".
Lists and Tables Recommended
Lists: list-style-type changes the marker (disc, decimal, none or a string), list-style-position places it inside or outside, and ::marker styles it. For navigation, remove markers with list-style: none and reset padding.
Tables:
border-collapse: collapsemerges adjacent cell borders into one.table-layout: fixedmakes column widths predictable and speeds up rendering of large tables.:nth-child(even)on rows gives zebra stripes.position: stickyonthkeeps headers visible while scrolling.caption-sidemoves the caption.
For wide tables on phones, wrap the table in a container with overflow-x: auto rather than shrinking text.
Practice. Style a data table with collapsed borders, zebra rows, sticky headers and a horizontal scroll on small screens.
Background: Color, Image, Position and Attachment Core
The background properties paint behind content and padding.
- Background color:
background-color: #f4f4f4. - Background image:
background-image: url("hero.jpg"), one or more, the first listed on top. background-repeat:no-repeat,repeat-xorspace.background-size:coverfills the box and crops;containshows the whole image.- Background position:
center,top rightor offsets likeright 1rem bottom 1rem. - Background attachment:
scroll(default) orfixed, which pins the image to the viewport. Fixed backgrounds can scroll poorly on mobile.
.hero { background: #222 url("hero.jpg") center / cover no-repeat; }Background images are decorative only; they have no alt. Put meaningful images in HTML with img.
Practice. Build a hero section with a cover image, a dark overlay and readable white text.
Background Gradient Recommended
A background gradient is an image generated by the browser, so it is set with background-image (or the background shorthand), not background-color.
.banner { background: linear-gradient(135deg, #4f46e5, #06b6d4); }
.spot { background: radial-gradient(circle at top, #fff, #ddd); }
.pie { background: conic-gradient(red 0 25%, gold 0 60%, teal 0); }
.hero { background: linear-gradient(rgb(0 0 0 / .5), rgb(0 0 0 / .5)), url(hero.jpg) center / cover; }linear-gradient runs along a line, radial-gradient spreads from a point and conic-gradient sweeps round a centre. Colour stops can have positions; two stops at the same position make a hard edge for stripes. Gradients layered over a photo are a simple way to improve text contrast.
Practice. Create a striped progress bar and a hero overlay using only gradients.
Images and Filters Recommended
Images inside layouts need a few properties to behave.
max-width: 100%; height: auto;stops images overflowing their container.object-fit: covercrops an image to fill a fixed box, like a background;object-positionchooses the focal point.display: blockremoves the small gap under inline images.
The filter property applies effects such as grayscale(), blur(), brightness(), contrast() and drop-shadow(), which follows the shape of transparent images. backdrop-filter blurs what is behind an element, the "frosted glass" effect. mix-blend-mode blends an element with what is underneath it.
Filters cost rendering time, so test on slower phones and avoid animating heavy blurs.
Practice. Build a photo grid with square thumbnails using object-fit and a hover effect that removes a greyscale filter.
Stage 6 Layout Fundamentals: Display, Position and Stacking
Goal. Control normal flow, position elements precisely and debug z-index problems.
Flow Layout and Display: Block, Inline and Inline-Block Core
Without layout CSS, elements follow flow layout, also called normal flow: blocks stack vertically, and inline content runs in lines that wrap.
The display property changes how a box takes part:
- Block display: starts on a new line, fills the width, respects width, height and all margins.
- Inline display: sits in a line of text; width and height are ignored and vertical padding does not push lines apart.
- Inline-block: flows like inline content but accepts width, height and vertical spacing, useful for buttons and badges.
flexandgridmake the element a layout container for its children.flow-rootcreates a new block formatting context, which contains floats and stops margin collapse.
display: contents removes the element's own box but keeps its children, though it has caused accessibility bugs in some browsers.
Practice. Turn a list of links into a horizontal menu three ways: inline, inline-block and flex.
Display: None, Visibility and Hiding Content Core
There are several ways to hide things, and they differ in layout and accessibility.
display: noneremoves the element completely: no space, not clickable, not read by screen readers.- Visibility:
visibility: hiddenhides the element but keeps its space, and it is also hidden from assistive technology. opacity: 0makes it invisible but it still takes space and can still be clicked and focused.- A visually-hidden utility class hides content from sight but keeps it for screen readers, used for labels on icon buttons.
.visually-hidden {
position: absolute; width: 1px; height: 1px;
overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}Display none vs visibility hidden is a common interview question; the key difference is whether space is kept.
Practice. Hide one element each way and record its layout space, clickability and what a screen reader announces.
Position: Static, Relative, Absolute, Fixed and Sticky Core
The position property takes elements out of normal placement. Offsets use top, right, bottom, left or inset.
- Static positioning is the default; offsets do nothing.
- Relative positioning shifts the element visually but keeps its original space. It also makes the element a reference for absolute children.
- Absolute positioning removes the element from flow and places it relative to the nearest positioned ancestor, or the page if there is none.
- Fixed positioning places it relative to the viewport, so it stays put during scrolling. A
transformon an ancestor breaks this. - Sticky positioning behaves like relative until a scroll threshold, then sticks like fixed within its parent. It fails if an ancestor has
overflow: hidden.
.card { position: relative; }
.card .badge { position: absolute; inset-block-start: 0.5rem; inset-inline-end: 0.5rem; }
Practice. Build a card with a corner badge, a sticky table header and a fixed back-to-top button.
Z-Index and Stacking Context Core
z-index sets the stacking order of positioned elements and flex or grid items; higher values sit in front. It only competes within the same stacking context.
A stacking context is a group that is layered as one unit. New contexts are created by, among others:
- the root element;
- a positioned element with a
z-indexother thanauto; opacitybelow 1,transform,filterorwill-changeon those properties;isolation: isolate.
So a modal with z-index: 9999 inside a parent with z-index: 1 can still appear behind a sibling with z-index: 2. The fix is to move the modal higher in the DOM or rework the parent's context, not to raise the number. The dialog element's top layer avoids this problem entirely. Understanding z-index and stacking context is a frequent senior interview topic.
Practice. Reproduce a dropdown hidden behind the next card, then fix it without raising any z-index above 10.
Floating Elements Optional
float: left or float: right pushes an element to one side and lets text wrap around it, as in printed magazines. That remains its proper use today: wrapping text around an image or pull quote.
Before flexbox and grid, floats were used to build whole page layouts, with "clearfix" hacks to stop parents collapsing. You will see this in older code; know how to read it, but do not build new layouts this way.
.figure-left { float: left; margin-inline-end: 1rem; width: 40%; }
.after { clear: both; }
.wrapper { display: flow-root; } /* contains floats */clear stops an element sitting beside earlier floats. shape-outside lets text wrap around a curved shape.
Practice. Wrap article text around an image floated left and stop the next section from wrapping.
Stage 7 Modern Layout: Flexbox, Grid and Columns
Goal. Build any common page or component layout with flexbox and grid and choose between them.
Flexbox Core
Flexbox lays out items along one axis, a row or a column. Set display: flex on the container and its direct children become flex items.
.toolbar {
display: flex;
justify-content: space-between; /* main axis */
align-items: center; /* cross axis */
gap: 0.75rem;
flex-wrap: wrap;
}flex-directionsets the main axis:roworcolumn.justify-contentspreads items along the main axis.align-itemsaligns them on the cross axis;align-selfoverrides one item.gapadds space between items.flex-wraplets items move onto new lines.
Centring something both ways is three lines: display: flex; justify-content: center; align-items: center. Avoid order and reversed directions for meaningful content; they change visual order without changing focus order.
Practice. Build a navigation bar with a logo on the left, links in the middle and a button on the right.
Flex Sizing: grow, shrink and basis Core
Each flex item has three sizing values, usually set with the flex shorthand.
flex-basis: the starting size before free space is shared.flex-grow: how much of the leftover space the item takes.flex-shrink: how much it gives up when space runs out.
.sidebar { flex: 0 0 16rem; } /* fixed 16rem */
.main { flex: 1; } /* takes the rest */flex: 1 means grow 1, shrink 1, basis 0, so items share space equally. A common bug: long words or wide content stop an item shrinking, because flex items have a minimum size of their content by default. Add min-width: 0 to the item to fix overflowing text.
Practice. Build a chat input row where the text field grows, the buttons never shrink, and long text does not overflow.
Grid Layout Core
Grid layout places items in rows and columns at the same time. Use it when you think in two dimensions: page layouts, card galleries, dashboards and forms.
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
gap: 1rem;
}That one rule gives a responsive gallery with no media queries: columns at least 14rem wide, as many as fit. fr shares free space; minmax() sets limits; auto-fill keeps empty tracks while auto-fit collapses them so items stretch.
Items can span tracks with grid-column: span 2 or be placed by line numbers such as grid-column: 1 / -1 to cover a full row. Alignment uses the same properties as flexbox, plus place-items as a shorthand.
Practice. Build a responsive card gallery with one grid declaration and make the first card span two columns.
Grid Template Areas and Subgrid Recommended
grid-template-areas names regions so layouts read like a map.
.page {
display: grid;
grid-template-columns: 15rem 1fr;
grid-template-areas: "header header" "nav main" "footer footer";
}
.page > header { grid-area: header; }
@media (width < 40rem) {
.page { grid-template-columns: 1fr;
grid-template-areas: "header" "main" "nav" "footer"; }
}Changing a layout at a breakpoint then becomes one rewrite of the map. subgrid lets a nested grid reuse its parent's tracks, so the titles and buttons in a row of cards line up even when content lengths differ. It is supported in all current major browsers.
Flexbox or grid? Flexbox when content decides sizes along one line; grid when the layout decides placement in two dimensions. Real pages mix both.
Practice. Build a holy-grail page layout with named areas that reorders for small screens.
Multicolumn Layout Optional
Multicolumn layout flows content into newspaper-style columns: text runs down the first column and continues at the top of the next.
.article { columns: 18rem 3; column-gap: 2rem; column-rule: 1px solid #ddd; }
.article h2 { column-span: all; }
.card { break-inside: avoid; }columns: 18rem 3 means columns at least 18rem wide, up to three. The browser reduces the count on narrow screens. break-inside: avoid stops a card splitting across columns.
It suits long lists, footnotes or a masonry-like gallery where order runs down columns. It is poor for long reading on screens, because readers must scroll back up for each new column.
Practice. Lay out a long list of links in balanced columns that collapse to one on phones.
Stage 8 Responsive Design
Goal. Build layouts and type that adapt to any screen, container and user preference.
Responsive Design Principles Core
Responsive design means one codebase that works from small phones to wide monitors. The principles:
- Start with the viewport meta tag in HTML, or mobile browsers zoom out.
- Design mobile first: write the base styles for small screens, then add rules as space grows. Small-screen layouts are usually simpler, so this keeps CSS shorter.
- Use fluid sizes: percentages,
fr,min(),max()andclamp()instead of fixed widths. - Let content decide breakpoints. Add one where the design starts to look wrong, not at specific device widths.
- Make images fluid and touch targets large, around 44 by 44 CSS pixels.
Test by resizing the browser slowly and with the device toolbar in DevTools, then on at least one real phone.
Practice. Take a fixed-width desktop page and make it work down to 320px wide.
Media Queries Core
Media queries apply styles when conditions about the device or user are true.
.grid { display: grid; gap: 1rem; }
@media (width >= 48rem) {
.grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
* { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (prefers-color-scheme: dark) {
:root { --bg: #111; --text: #eee; }
}The range syntax (width >= 48rem) is supported in current browsers and reads better than min-width. Other useful features: hover and pointer to detect touch versus mouse, orientation, prefers-contrast and print for print styles.
Using em or rem in breakpoints keeps them consistent when users zoom text.
Practice. Add a dark theme and a reduced-motion mode to a page using only media queries and custom properties.
Container Queries Recommended
Media queries respond to the viewport. Container queries respond to the size of a parent, so a component adapts to wherever it is placed: a narrow sidebar or a wide main column.
.card-wrap { container-type: inline-size; }
@container (width > 30rem) {
.card { display: grid; grid-template-columns: 10rem 1fr; }
}Mark the parent as a container with container-type, optionally name it with container-name, then query it with @container. Container units such as cqi size things relative to the container.
They are supported in all current major browsers and are a better fit than media queries for reusable components in a design system. Page-level layout still suits media queries.
Practice. Build a product card that is stacked in a sidebar and horizontal in the main column, with no media queries.
Responsive Typography Recommended
Responsive typography makes text scale smoothly with available space while staying readable.
:root { font-size: 100%; } /* respect user settings */
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.5rem); }
p { max-width: 65ch; }clamp() with a rem plus vw middle value gives fluid sizes with sensible limits. Always include a rem part; pure vw sizes ignore browser zoom, which fails accessibility rules.
Other points: keep line length around 45 to 75 characters, reduce heading line height as size grows, and never set the root font size in px, which overrides the user's chosen size. A type scale in custom properties keeps sizes consistent across the site.
Practice. Build a fluid type scale with clamp() and check that zooming to 200% still enlarges all text.
Stage 9 Motion, Accessibility and Performance
Goal. Add smooth, respectful motion and keep styles accessible and fast.
Transitions Core
Transitions animate a property between two values when it changes, for example on hover or when a class is added.
.button {
background: navy;
transition: background-color 200ms ease, transform 150ms ease-out;
}
.button:hover { background: royalblue; transform: translateY(-2px); }Specify the property, duration, timing function (ease, linear, ease-in-out or a cubic-bezier()) and optional delay. Avoid transition: all; it animates things you did not intend and costs performance.
Some properties cannot transition, such as display. Newer features help: transition-behavior: allow-discrete and @starting-style animate elements as they appear, though support is still settling, so treat them as enhancements.
Practice. Add hover, focus and active transitions to a button set, keeping each under 250ms.
Transforms Core
Transforms move, rotate, scale or skew an element without affecting layout around it.
.icon:hover { transform: rotate(15deg) scale(1.1); }
.panel { translate: 0 100%; } /* individual property */
.flip { transform: perspective(600px) rotateY(180deg); }Functions apply right to left in the transform list, so order changes the result. Individual properties translate, rotate and scale can be set and transitioned separately. transform-origin sets the pivot point.
Transforms and opacity are the cheapest properties to animate, because the browser can handle them on the compositor without recalculating layout. Remember that a transform creates a new stacking context and a new containing block for fixed children.
Practice. Build a card that flips in 3D on hover to show its back side.
Keyframe Animations Core
Keyframe animations run multi-step sequences that do not need a state change to start.
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.08); }
}
.badge { animation: pulse 1.5s ease-in-out infinite; }The animation shorthand sets name, duration, timing, delay, iteration count, direction, fill mode and play state. animation-fill-mode: forwards keeps the final frame.
Respect prefers-reduced-motion: large movement, parallax and spinning can cause nausea for some users. Offer reduced or no motion for them. Scroll-driven animations, linked to scroll position with animation-timeline, are arriving in browsers; check support before using them.
Practice. Build a loading spinner and a skeleton shimmer, both of which stop under reduced-motion settings.
Accessibility Core
CSS can make or break accessibility.
- Contrast: text needs at least 4.5:1 against its background, 3:1 for large text and interface parts.
- Focus: every interactive element needs a visible focus style; use
:focus-visible. - Zoom and text size: use
rem, avoid fixed heights, and make sure layouts work at 200% zoom and 320px width. - Motion: honour
prefers-reduced-motion. - Order: visual order from flex
order, grid placement or absolute positioning must match DOM order, or keyboard users get lost. - Colour alone: do not signal errors or states only by colour; add text or icons.
- Hidden content: choose the right hiding method so screen readers get what they need.
- Support forced colours mode (Windows High Contrast) by using real borders, not only background colours, to outline controls.
Practice. Audit a page for contrast, focus, zoom and motion, and fix every failure.
Performance Recommended
CSS affects speed in a few predictable ways.
- CSS blocks rendering, so keep the critical path small: inline essential styles if needed and avoid chains of
@import. - Remove unused CSS; large frameworks often ship far more than a page uses.
- Animate
transformandopacity. Animatingwidth,topormarginforces layout on every frame. - Avoid layout shift: set sizes or
aspect-ratioon media and reserve space for late content. - Use
font-display: swapand limit font files. content-visibility: autolets the browser skip rendering offscreen sections.- Use
will-changesparingly, only just before an animation.
Selector matching speed is rarely a real problem today; measure with the Performance panel before optimising selectors.
Practice. Record a Performance profile of a janky animation, rewrite it to use transforms and compare frame rates.
Stage 10 Architecture and Tooling
Goal. Organise CSS for large codebases and work with the tools teams use.
BEM and Naming Conventions Recommended
As stylesheets grow, naming becomes the main defence against conflicts. BEM (Block, Element, Modifier) is the best-known convention.
.card {} /* block */
.card__title {} /* element of the block */
.card--featured {} /* modifier: a variant */Every selector is a single class, so specificity stays flat and predictable, and the class name tells you where the style lives. Other approaches follow similar ideas: utility classes that do one thing each, or scoped styles generated by tooling.
Whatever the method, aim for low specificity, components that do not depend on where they are placed, and a small set of shared design tokens held in custom properties.
Practice. Refactor a stylesheet with nested descendant selectors into BEM classes and compare specificity.
Sass Recommended
Sass is a preprocessor: you write .scss files with extra features and compile them to normal CSS.
$radius: 8px;
@mixin focus-ring { outline: 3px solid royalblue; outline-offset: 2px; }
.button {
border-radius: $radius;
&:focus-visible { @include focus-ring; }
&--primary { background: navy; }
}Its main features are variables, nesting, mixins, functions, loops and splitting code into partials with @use. The old @import rule in Sass is deprecated in favour of @use and @forward.
Native CSS has caught up: custom properties, nesting and colour functions now exist in browsers. Many new projects use plain CSS, but Sass remains common in existing codebases, so be able to read it.
Practice. Convert a small Sass file to plain modern CSS using custom properties and native nesting.
PostCSS Optional
PostCSS is a tool that transforms CSS with JavaScript plugins. It is usually part of a build pipeline rather than something you call directly.
Common plugins:
- Autoprefixer adds vendor prefixes based on a list of target browsers.
- Preset Env lets you write newer CSS syntax and compiles it down for older browsers.
- cssnano minifies output.
Frameworks such as Tailwind CSS are built on PostCSS, and build tools like Vite run it automatically when they find a config file. Lightning CSS is a faster alternative doing similar jobs. You rarely need to write plugins; know what the tool does and how to read its config.
Practice. Add Autoprefixer to a Vite project, set a browser target, and inspect the prefixed output.
CSS Modules Recommended
CSS Modules are ordinary CSS files where class names are scoped to the component that imports them. The build tool rewrites .title to a unique name such as Card_title__x7f2, so two components can both use .title without clashing.
/* Card.module.css */
.title { font-weight: 700; }
// Card.jsx
import styles from './Card.module.css';
<h2 className={styles.title}>Hello</h2>They are supported out of the box by Vite, Next.js and most React toolchains. You keep plain CSS and zero runtime cost, with the safety of local names. Global styles, resets and custom properties still live in normal stylesheets.
Practice. Build two components that both use a .title class with CSS Modules and confirm in DevTools that the names differ.
CSS-in-JS and Utility-First CSS Optional
CSS-in-JS libraries let you write styles inside JavaScript components, often with props that change styles. Runtime libraries generate CSS in the browser, which costs performance and works poorly with React Server Components. Zero-runtime options extract static CSS at build time and avoid that cost.
Utility-first CSS, with Tailwind CSS as the main example, takes another route: small single-purpose classes applied directly in the markup.
<button class="rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700">Save</button>Each approach trades readability, reuse and tooling differently. Teams choose based on their framework and habits. In interviews, explain the trade-offs rather than declaring a winner, and show that your plain CSS skills carry over to all of them.
Practice. Build the same button with plain CSS, a CSS Module and utility classes, and list the pros and cons of each.
Projects to build
Build these in order. Each one should end up in a public repository with a short README that explains your decisions.
- Styled article pageBeginner
Style a long-form article with a type scale, comfortable line length, styled links, block quotes, figures with captions and a data table. Use only external CSS and custom properties for colours and spacing.
Selectors · Typography · Box model · CSS variables · Tables
- Responsive landing pageIntermediate
Rebuild a product landing page from a mock-up: navigation bar, hero with a background image and gradient overlay, feature grid, pricing cards and footer. It must work from 320px to wide screens, mobile first, with no horizontal scrolling.
Flexbox · Grid layout · Media queries · Backgrounds · Responsive typography
- Component library with themesIntermediate
Build buttons, inputs, cards, alerts, tabs and a modal with BEM or CSS Modules. Support light, dark and high-contrast themes through custom properties, and make every component adapt with container queries.
BEM · CSS variables · Container queries · Focus styles · Pseudo-classes
- Dashboard layoutAdvanced
Create an admin dashboard with a sticky header, a collapsible sidebar, a grid of resizable widgets using subgrid, sticky table headers and dropdown menus that never fall behind other content. Document your z-index scale.
Grid template areas · Position · Z-index and stacking context · Overflow · Logical properties
- Animated, accessible micro-siteAdvanced
Build a short story or product tour with keyframe animations, 3D transforms and transitions that stay at a smooth frame rate. Provide a reduced-motion version, pass a contrast audit, and measure layout shift and animation performance.
Keyframe animations · Transforms · Transitions · Accessibility · Performance
Interview questions
Try to answer each question out loud before you open the answer.
Explain the CSS box model.Junior
Every element is a box with four layers: content, padding, border and margin. With the default content-box, width applies only to the content, so padding and border are added on top and the box ends up wider than set. With border-box, width includes padding and border, which is easier to reason about, so most projects apply it globally. Margins sit outside and are transparent, and vertical margins between blocks can collapse into one.
How does specificity work?Junior
Each selector gets a score in three columns: ids, then classes, attributes and pseudo-classes, then elements and pseudo-elements. The browser compares columns from the left, so one id beats any number of classes. If scores are equal, the later rule wins. Inline styles beat stylesheet selectors, and !important jumps above normal declarations. I keep specificity low with single class selectors so rules are easy to override, and use cascade layers when combining third-party CSS.
What is the difference between display: none, visibility: hidden and opacity: 0?Junior
display: none removes the element from layout and from the accessibility tree; it takes no space and cannot be interacted with. visibility: hidden hides it and removes it from assistive technology, but keeps its space. opacity: 0 only makes it transparent: it keeps its space, can still receive clicks and focus, and screen readers still read it. To hide something visually but keep it for screen readers, I use a visually-hidden utility class.
What is the difference between em and rem?Junior
Both are relative to a font size. rem is relative to the root element's font size, so it is consistent everywhere. em is relative to the current element's font size, so values compound when elements nest: an em font size inside another scaled element grows or shrinks again. I use rem for font sizes and general spacing, and em for things that should scale with the component's own text, such as padding on a button.
Explain the position values and how absolute positioning chooses its reference.Mid
static is normal flow. relative offsets an element visually while keeping its space. absolute removes it from flow and positions it against the nearest ancestor that is positioned, meaning any value other than static, or against the initial containing block if none exists. fixed positions against the viewport, unless an ancestor has a transform or filter. sticky acts relative until its scroll threshold, then sticks within its scrolling container; an overflow: hidden ancestor often breaks it.
When do you use flexbox and when grid?Mid
Flexbox is for one dimension: items in a row or a column where content size drives the layout, such as toolbars, button groups or a media object. Grid is for two dimensions: when I want to define rows and columns and place items into them, such as page layouts, galleries and forms with aligned labels. They combine well; a grid page can have flex components inside. With gap, alignment properties and subgrid, both handle cases that used to need floats and hacks.
Why does my z-index not work?Mid
Usually for one of two reasons. Either the element is not positioned and is not a flex or grid item, so z-index has no effect. Or it sits inside a different stacking context: a parent with opacity below 1, a transform, a filter, or its own z-index groups its children, and they cannot rise above that parent's siblings. I find which ancestor creates the context in DevTools, then restructure or use isolation, rather than raising numbers.
How do you centre an element horizontally and vertically?Mid
The simplest modern approach is on the parent: display: grid; place-items: center;, or flexbox with justify-content: center and align-items: center. For a block with a known width inside normal flow, margin-inline: auto centres it horizontally. For an overlay, absolute positioning with inset: 0 and margin: auto, or translate(-50%, -50%) from 50% offsets, works. I pick based on whether the parent already has a layout mode.
What are CSS custom properties and how do they differ from Sass variables?Mid
Custom properties such as --brand are part of CSS itself. They cascade and inherit, so I can redefine them on a selector, inside a media query, or from JavaScript, and everything using them updates live. That makes them ideal for theming and design tokens. Sass variables are replaced at compile time; the browser never sees them, so they cannot change at runtime or per element. I use custom properties for anything themeable and preprocessors only where a codebase already relies on them.
What are container queries and when would you use them instead of media queries?Mid
Container queries style an element based on the size of its container rather than the viewport. You set container-type: inline-size on a parent and write @container rules. I use them for reusable components, such as a card that appears in a sidebar and in a main column, because the component then adapts wherever it is placed. Media queries remain right for page-level layout and for user preferences such as reduced motion or dark mode.
Which properties are cheap to animate, and why?Senior
transform and opacity are cheap because browsers can handle them in the compositing step, often on the GPU, without recalculating layout or repainting. Animating width, height, top, left or margin forces layout every frame, and properties such as box-shadow or background force repaint. So I move things with translate, fade with opacity, and use will-change sparingly just before heavy animations. I verify with the Performance panel and honour reduced-motion preferences.
How would you organise CSS for a large application?Senior
I start with design tokens as custom properties: colours, spacing, type and radii. Then I use cascade layers to set clear priority, for example reset, base, components, utilities, with third-party CSS in its own low layer. Components get scoped styles through CSS Modules or a convention such as BEM, so specificity stays flat and nothing depends on page context. I add linting, remove unused CSS in the build, document the z-index scale, and keep visual regression tests for shared components.
How do you make CSS support accessibility?Senior
I keep contrast above WCAG ratios, give every control a clear :focus-visible style, and use rem and fluid layouts so the page works at 200% zoom and 320px wide. I never rely on colour alone for meaning. I keep visual order aligned with DOM order, respect prefers-reduced-motion and test forced colours mode. I choose hiding techniques by intent, and I check that text spacing overrides do not cause clipping.
Common mistakes
- Fighting specificity with
!importantand longer selectors; keep selectors to single classes and use cascade layers. - Setting fixed heights on boxes with text, so content overflows when it grows; let height follow content and use
min-height. - Removing focus outlines for looks; restyle them with
:focus-visibleinstead. - Using
pxfor font sizes and the root size, which ignores user settings; userem. - Raising z-index to huge numbers without understanding stacking contexts; find the ancestor that creates the context.
- Building layouts with floats or absolute positioning; use flexbox and grid.
- Animating
width,toporleft; animatetransformandopacity. - Writing desktop styles first and patching phones with overrides; write mobile-first base styles and add larger breakpoints.
- Using
transition: all; list only the properties you mean to animate.
Ready-for-interview checklist
- I can explain the cascade and calculate the specificity of any selector.
- I can explain the box model and why most projects use
border-box. - I can choose between
px,rem,em,%, viewport units andfrand justify the choice. - I can use combinators, pseudo-classes including
:has(), and pseudo-elements correctly. - I can explain every
positionvalue and debug a stacking context problem. - I can build navigation bars and toolbars with flexbox and page layouts with grid.
- I can build a responsive page mobile-first with fluid type and sensible breakpoints.
- I can use container queries for a reusable component.
- I can theme a site with custom properties, including dark mode.
- I can write smooth transitions and keyframe animations and respect reduced-motion settings.
- I can meet contrast, focus and zoom requirements with my CSS.
- I can explain BEM, CSS Modules, Sass and utility-first CSS and their trade-offs.
Related roadmaps
- HTML RoadmapSemantic structure, forms, media, accessibility and SEO basics.
- JavaScript RoadmapLanguage core, async, the event loop, modules and the DOM.
- Design System RoadmapTokens, components, documentation, governance and adoption.
- React RoadmapComponents, hooks, state, data fetching, performance and testing.
- SEO for Developers RoadmapCrawling, indexing, Core Web Vitals, structured data and content.
FAQ
How long does it take to learn CSS?
Basic styling takes a couple of weeks. Being comfortable with layout, responsive design and debugging the cascade usually takes two to three months of steady practice, about six hours a week. Most people keep learning CSS throughout their career because the language keeps adding features.
Should I learn Tailwind or plain CSS first?
Plain CSS first. Tailwind and similar tools are a different way of writing the same properties, and you cannot debug utility classes without knowing the box model, flexbox, grid and the cascade. Once those are solid, picking up any framework takes days.
Is Sass still worth learning?
Learn to read it, because many existing codebases use it. For new projects, native CSS now covers the most popular Sass features, including variables, nesting and colour functions, so many teams no longer add a preprocessor. Spend most of your time on modern CSS itself.
Do I need to memorise every CSS property?
No. Know the core ideas deeply: cascade, box model, units, display, position, flexbox, grid and media queries. Look up the rest as you need it. Interviewers care far more about how you reason through a layout problem than about remembering rare property names.
Is CSS a programming language?
CSS is usually described as a style sheet language rather than a programming language, since it declares how things should look instead of giving step-by-step instructions. It still has variables, functions, conditions through queries, and complex rules, and it takes real skill to use well.