CSS Properties Reference
Essential CSS properties grouped into six categories — box model, typography, layout, flexbox, grid, and visual effects — each with common values and descriptions.
Box Model
Control spacing, size, and borders around elements.
| Property | Description |
|---|---|
margin | Outer spacing — shorthand for all four sides |
margin-top / right / bottom / left | Individual margin sides |
padding | Inner spacing — shorthand for all sides |
padding-top / right / bottom / left | Individual padding sides |
border | Shorthand: width style color |
border-width | Thickness of the border |
border-style | Border line style |
border-color | Border color |
border-radius | Round corners (or make circles) |
width | Element width |
height | Element height |
min-width / max-width | Clamp width to a range |
min-height / max-height | Clamp height to a range |
box-sizing | Include padding/border in declared size |
overflow | Clip or scroll overflowing content |
Typography
Control font, size, weight, spacing, and color.
| Property | Description |
|---|---|
font-family | Typeface stack |
font-size | Text size |
font-weight | Thickness of letterforms |
font-style | Normal or italic styling |
line-height | Vertical spacing between lines |
letter-spacing | Space between characters |
word-spacing | Space between words |
text-align | Horizontal alignment |
text-decoration | Underline, strikethrough, etc. |
text-transform | Capitalization |
color | Text color |
white-space | Handle whitespace and wrapping |
text-overflow | What to show when text overflows |
text-shadow | Shadow behind text |
Layout & Positioning
Control how elements are placed in the document flow.
| Property | Description |
|---|---|
display | Rendering mode of the element |
position | Positioning scheme |
top / right / bottom / left | Offset from positioned ancestor |
z-index | Stacking order (higher = in front) |
float | Float element to left or right of flow |
clear | Prevent floating elements from sitting alongside |
visibility | Show or hide (hidden still takes space) |
opacity | Transparency (0 = invisible) |
Flexbox
One-dimensional layout: rows or columns.
| Property | Description |
|---|---|
display: flex | Enable flexbox on the container |
flex-direction | Main axis direction |
flex-wrap | Allow items to wrap to next line |
justify-content | Alignment on main axis |
align-items | Alignment on cross axis |
align-content | Multi-line cross-axis alignment |
gap | Space between flex or grid items |
flex | Shorthand: grow shrink basis |
flex-grow | How much the item grows |
flex-shrink | How much the item shrinks |
flex-basis | Initial main size before growing/shrinking |
align-self | Override align-items for one item |
order | Visual order of a flex item |
Grid
Two-dimensional layout: rows and columns simultaneously.
| Property | Description |
|---|---|
display: grid | Enable grid layout on the container |
grid-template-columns | Define column tracks |
grid-template-rows | Define row tracks |
grid-template-areas | Named layout areas |
grid-column | Column start / end or span |
grid-row | Row start / end or span |
grid-area | Place item in a named area |
column-gap / row-gap | Space between columns / rows |
grid-auto-flow | Auto-placement algorithm |
Visual & Effects
Backgrounds, shadows, transforms, and transitions.
| Property | Description |
|---|---|
background | Shorthand background |
background-color | Solid background color |
background-image | Background image or gradient |
background-size | Scale the background image |
background-position | Position background image |
box-shadow | Drop shadow on element |
transform | Translate, rotate, scale, skew |
transition | Animate property changes |
animation | Keyframe animation |
filter | Visual filters (blur, brightness, etc.) |
backdrop-filter | Filter behind a translucent element (glassmorphism) |
cursor | Mouse cursor appearance |
Practice typing these in CodeSpeedTest →
CSS mastery is about repetition. Type real CSS — flexbox layouts, animations, grid definitions — until the property names come without thinking.