
This CSS reference brings together selectors, properties, and common values from the beginner, intermediate, and advanced lessons. Examples show typical syntax. They are not exhaustive lists of valid values.
1. Beginner CSS
| Topic | Syntax and common values | What it does |
|---|---|---|
| Selector syntax | selector { property: value; } | A declaration pairs a property with a value inside a rule. |
| Basic selectors | *, p, .card, #main, a b, a > b, a + b, a ~ b, a, b | Match by type, class, ID, or relationships. A comma separates alternatives. |
| Units | px, em, rem, %, vw, vh, fr | Choose the unit according to what should control the size. |
| Basic colors | black, white, red, green, blue, transparent, currentColor | Named colors are convenient for examples. Hex, RGB, and HSL give more control. |
| Foreground and backgrounds | color; background-color; background-image; background-repeat; background-attachment; background-position; background-size; opacity | Use cover to fill the area or contain to fit the image. An alpha color can fade the background independently of the text. |
| Text | text-indent; text-align; text-decoration; letter-spacing; word-spacing; text-transform; line-height; vertical-align | Adjust alignment, spacing, decoration, and displayed case. |
| Fonts | font-family; font-style; font-variant; font-weight; font-size | List fallback families and check the font’s available styles and weights. |
| Lists | list-style-type; list-style-image; list-style-position; list-style | The shorthand combines marker type, position, and image. |
| Tables | caption-side; table-layout; border-collapse; border-spacing; empty-cells | Border spacing requires separate borders. Table layout controls how columns are sized. |
| Structural pseudo-classes | :first-child; :last-child; :nth-child(); :nth-of-type(); :only-child | Count positions among all siblings or among siblings of one element type. |
| State pseudo-classes | :hover; :focus; :focus-visible; :active; :link; :visited | Use clear keyboard focus feedback as well as hover styling. |
| Pseudo-elements | ::first-line; ::first-letter; ::before; ::after; ::selection | Style part of an element or generate decorative content. |
| Box model | margin; padding; border | Margin is outside the border. Padding is inside it. |
| Size limits | width; height; min-width; min-height; max-width; max-height | Set a preferred dimension, a minimum, or a maximum. |
| Container behavior | display; position; float; clear; z-index; visibility | Control layout, positioning, stacking, and visibility. |
| Box sizing | box-sizing: content-box or border-box | With border-box, the declared dimensions include padding and border. |
| Overflow | overflow; overflow-x; overflow-y | Choose visible, hidden, clip, scroll, or auto for overflowing content. |
2. Intermediate CSS
| Topic | Syntax and common values | What it does |
|---|---|---|
| Media types | @media print; @import url(...) print; media="screen" | Style output according to the media condition. |
| Media queries | min-width; max-width; orientation; hover; prefers-reduced-motion | Combine features with and or use commas for alternatives. |
| Cursor | cursor: auto, default, pointer, text, grab, wait, not-allowed | Choose an appropriate pointer appearance without relying on it as the only feedback. |
| Shadows | box-shadow; text-shadow | Specify offsets, blur, and color. Box shadows can also use spread and inset. |
| Attribute selectors | [attr], [attr="x"], [attr~="x"], [attr|="x"], [attr^="x"], [attr$="x"], [attr*="x"] | Match presence, exact value, a word, a language prefix, or a substring. |
| Web fonts | @font-face; font-family; src; font-display | Load a licensed font in an appropriate web format and define a fallback. |
| Flexbox | display: flex; flex-direction; flex-wrap; justify-content; align-items; gap; flex | Arrange items along a main axis and align them on the cross axis. |
3. Advanced CSS
| Topic | Syntax and common values | What it does |
|---|---|---|
| Custom properties | --name; var(--name, fallback) | Store a value in the cascade and reuse it with var(). |
| Gradients | linear-gradient(); radial-gradient() | Create image values from color stops without an external image file. |
| Transitions | transition-property; transition-duration; transition-timing-function; transition-delay | Interpolate supported values between states. |
| Transforms | transform; translate(); rotate(); scale(); skew() | Move, rotate, resize, or slant a painted element. The normal layout space is generally preserved. |
| Animations | @keyframes; animation-name; animation-duration; animation-timing-function; animation-iteration-count | Define intermediate states and control their timing and repetition. |
| Math functions | calc(); min(); max(); clamp() | Calculate or constrain compatible values. |
| Grid | display: grid; grid-template-columns; grid-template-rows; grid-column; grid-row; gap | Define tracks and place items in rows and columns. |
| Fluid sizing | clamp(minimum, preferred, maximum) | Set a preferred value constrained by lower and upper bounds. |
| Line clamping | line-clamp; -webkit-line-clamp | Limit visible lines where supported. Test a fallback and keep important information available. |
| Scroll snapping | scroll-snap-type; scroll-snap-align; scroll-padding | Define snap positions for a scroll container and its children. |
| Scroll behavior | scroll-behavior: auto or smooth | Controls scrolling triggered by navigation or CSSOM. Respect reduced-motion preferences. |
| Blend modes | mix-blend-mode: normal, multiply, screen, overlay | Blend an element with its backdrop and check the resulting contrast. |
| Hyphenation | hyphens: none, manual, auto | Automatic hyphenation depends on language metadata and browser support. |
| Filters | filter: blur(), brightness(), grayscale(), drop-shadow() | Apply a visual effect to a rendered element. |
| Vendor prefixes | -webkit-, -moz-, -ms- | Check actual browser requirements. Use standard declarations and add compatibility prefixes where necessary. |
Using the reference
Start by identifying what to style, then choose the property and look up its valid values. Check the result in DevTools and validate the stylesheet with the CSS verification tools. When you are ready, try the CSS knowledge quiz.
For more detail, consult the MDN CSS reference or the HTML tag reference.