CSS Properties Reference

Complete reference of CSS properties grouped by category, with accepted values and descriptions.

Box Model 20 properties

PropertyDescriptionValues / Syntax
widthSets the width of an element.auto | length | %
min-widthSets the minimum width. Prevents shrinking below this.0 | length | %
max-widthSets the maximum width. Prevents growing beyond this.none | length | %
heightSets the height of an element.auto | length | %
min-heightSets the minimum height.0 | length | %
max-heightSets the maximum height.none | length | %
marginShorthand for margin-top, right, bottom, left.auto | length | % (1-4 values)
margin-topSets top margin of an element.0 | length | % | auto
margin-rightSets right margin.0 | length | % | auto
margin-bottomSets bottom margin.0 | length | % | auto
margin-leftSets left margin.0 | length | % | auto
paddingShorthand for padding inside the border.0 | length | % (1-4 values)
padding-topSpace between content and top border.0 | length | %
padding-rightSpace between content and right border.0 | length | %
padding-bottomSpace between content and bottom border.0 | length | %
padding-leftSpace between content and left border.0 | length | %
box-sizingborder-box includes padding+border in width/height.content-box | border-box
overflowControls what happens to overflowing content.visible | hidden | scroll | auto | clip
overflow-xControls horizontal overflow.visible | hidden | scroll | auto
overflow-yControls vertical overflow.visible | hidden | scroll | auto

Border 13 properties

PropertyDescriptionValues / Syntax
borderShorthand: border-width, border-style, border-color.width style color
border-widthSets thickness of all four borders.thin | medium | thick | length
border-styleSets style of all borders.none | solid | dashed | dotted | double | groove | ridge | inset | outset
border-colorSets color of all four borders.color | transparent
border-topShorthand for top border.width style color
border-rightShorthand for right border.width style color
border-bottomShorthand for bottom border.width style color
border-leftShorthand for left border.width style color
border-radiusRounds corners. 50% creates a circle.0 | length | % (1-4 values)
border-collapseFor tables: collapse merges adjacent borders.separate | collapse
border-spacingSets spacing between table cells (border-collapse: separate).length
outlineDraws a line outside the border. Does not affect layout.width style color
outline-offsetAdds space between element edge and outline.length

Display & Position 11 properties

PropertyDescriptionValues / Syntax
displaySpecifies the display type of an element.block | inline | inline-block | flex | grid | none | contents | table | ...
positionSpecifies the positioning method.static | relative | absolute | fixed | sticky
topFor positioned elements: distance from the top.auto | length | %
rightDistance from the right edge.auto | length | %
bottomDistance from the bottom edge.auto | length | %
leftDistance from the left edge.auto | length | %
z-indexStacking order. Higher value = on top. Only works with positioned elements.auto | integer
floatTakes element out of normal flow, floats to side.none | left | right
clearPrevents element from wrapping around floats.none | left | right | both
visibilityhidden hides element but keeps space.visible | hidden | collapse
clip-pathClips element to a shape.clip-source | basic-shape | border-box | ...

Flexbox 13 properties

PropertyDescriptionValues / Syntax
flex-directionDirection of flex items in the container.row | row-reverse | column | column-reverse
flex-wrapWhether flex items wrap to next line.nowrap | wrap | wrap-reverse
flex-flowShorthand for flex-direction and flex-wrap.flex-direction flex-wrap
justify-contentAligns items along main axis.flex-start | flex-end | center | space-between | space-around | space-evenly
align-itemsAligns items along cross axis.stretch | flex-start | flex-end | center | baseline
align-contentAligns flex lines (multi-line containers).stretch | flex-start | flex-end | center | space-between | space-around
gapShorthand for row-gap and column-gap in flex/grid.length
flexShorthand for flex-grow, shrink, basis.flex-grow flex-shrink flex-basis | auto | none
flex-growHow much a flex item grows relative to siblings.0 | number
flex-shrinkHow much a flex item shrinks relative to siblings.1 | number
flex-basisInitial size of a flex item before growing/shrinking.auto | length | %
align-selfOverride align-items for a single flex item.auto | flex-start | flex-end | center | baseline | stretch
orderControls the order flex items appear in a container.0 | integer

Grid 13 properties

PropertyDescriptionValues / Syntax
grid-template-columnsDefines column tracks in a grid container.none | track-list | auto | repeat()
grid-template-rowsDefines row tracks in a grid container.none | track-list | auto | repeat()
grid-template-areasDefines named grid areas for template-based layouts.string (area names)
grid-templateShorthand for grid-template-rows, -columns, -areas.shorthand for rows/cols/areas
grid-columnShorthand to place item across columns.start / end
grid-rowShorthand to place item across rows.start / end
grid-column-gapGap between grid columns. Prefer column-gap.length
grid-row-gapGap between grid rows. Prefer row-gap.length
grid-auto-columnsSize of implicitly created column tracks.auto | length | min-content | fr
grid-auto-rowsSize of implicitly created row tracks.auto | length | min-content | fr
grid-auto-flowControls auto-placement algorithm.row | column | row dense | column dense
place-itemsShorthand for align-items and justify-items in grid.align-items justify-items
place-contentShorthand for align-content and justify-content.align-content justify-content

Typography 23 properties

PropertyDescriptionValues / Syntax
fontShorthand for font properties.style variant weight size/line-height family
font-familySpecifies the font. Use fallbacks: 'Arial', sans-serif.family-name | generic-family
font-sizeSize of the font. Use rem for accessibility.medium | small | large | length | %
font-weightThickness of font characters.normal | bold | 100-900
font-styleNormal, italic, or oblique.normal | italic | oblique
font-variantsmall-caps displays lowercase as small uppercase.normal | small-caps
line-heightHeight between lines. Number (e.g. 1.6) is preferred.normal | number | length | %
letter-spacingSpace between characters.normal | length
word-spacingSpace between words.normal | length
text-alignHorizontal alignment of inline content.left | right | center | justify | start | end
text-align-lastHow the last line of a block is aligned.auto | left | right | center | justify
text-decorationShorthand for text decoration lines.none | underline | overline | line-through
text-decoration-colorColor of the text decoration line.color
text-decoration-styleStyle of the text decoration.solid | double | dotted | dashed | wavy
text-transformControls capitalization.none | uppercase | lowercase | capitalize
text-indentIndentation of the first line in a text block.0 | length | %
text-overflowHow overflowed text is signaled. Use with overflow:hidden.clip | ellipsis
text-shadowAdds shadow to text.h-offset v-offset blur-radius color
white-spaceControls whitespace handling.normal | nowrap | pre | pre-wrap | pre-line | break-spaces
word-breakSpecifies where line breaks occur in long words.normal | break-all | keep-all | break-word
word-wrapAllows long words to break and wrap onto next line.normal | break-word
directionText direction: left-to-right or right-to-left.ltr | rtl
unicode-bidiUsed with direction property.normal | embed | bidi-override

Color & Background 12 properties

PropertyDescriptionValues / Syntax
colorSets the foreground color of text.color-value
opacityTransparency of an element (0 = invisible, 1 = opaque).0-1
backgroundShorthand for all background properties.color position/size repeat attachment origin clip image
background-colorSets the background color.transparent | color
background-imageSets one or more background images.none | url() | gradient
background-repeatControls image repetition.repeat | repeat-x | repeat-y | no-repeat | space | round
background-positionPosition of the background image.top left | center | x% y% | x y
background-sizecover fills, contain fits without cropping.auto | cover | contain | length
background-attachmentfixed creates parallax effect.scroll | fixed | local
background-originWhere background image starts.padding-box | border-box | content-box
background-clipHow far background extends.border-box | padding-box | content-box | text
background-blend-modeBlending of each background layer.normal | multiply | screen | overlay | ...

Transitions & Animations 14 properties

PropertyDescriptionValues / Syntax
transitionShorthand for CSS transitions.property duration timing-function delay
transition-propertyWhich property to transition.all | none | property-name
transition-durationDuration of the transition (e.g. 0.3s, 500ms).0s | time
transition-timing-functionSpeed curve of transition.ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier()
transition-delayDelay before transition starts.0s | time
animationShorthand for all animation properties.name duration timing iteration direction fill-mode delay
animation-nameName of @keyframes rule.none | keyframe-name
animation-durationDuration of one animation cycle.0s | time
animation-timing-functionSpeed curve of animation.ease | linear | steps() | cubic-bezier()
animation-iteration-countNumber of times animation plays.1 | infinite | number
animation-directionWhether animation plays forwards, backwards, or alternates.normal | reverse | alternate | alternate-reverse
animation-fill-modeStyles applied before/after animation.none | forwards | backwards | both
animation-play-statePause or resume animation via JS.running | paused
animation-delayDelay before animation begins.0s | time

Transforms 9 properties

PropertyDescriptionValues / Syntax
transformApplies 2D or 3D transformation.none | transform-functions
transform-originPoint around which transform is applied.50% 50% | x y z
transform-styleWhether children are in 3D space.flat | preserve-3d
perspectiveDistance of viewer from z=0 plane (3D).none | length
perspective-originPosition of the vanishing point for 3D perspective.50% 50% | x y
backface-visibilityWhether back face of element is visible when rotated.visible | hidden
rotateCSS property shorthand (CSS Transforms Level 2).angle
scaleCSS property shorthand for scaling.number
translateCSS property shorthand for translation.x y

CSS Variables & Custom 6 properties

PropertyDescriptionValues / Syntax
--variable-nameDefines a custom property (CSS variable). Access via var(--name).any CSS value
var()References a CSS custom property value.var(--name, fallback)
calc()Performs calculations. Can mix units: calc(100% - 60px).calc(expression)
min()Returns smallest value. Responsive sizing: min(50%, 300px).min(value, value)
max()Returns largest value.max(value, value)
clamp()Clamps a value between min and max. Great for fluid typography.clamp(min, val, max)

Selectors 28 properties

PropertyDescriptionValues / Syntax
*Selects all elements.- (universal)
.classSelects all elements with a given class.- (class)
#idSelects element with a specific ID.- (id)
elementSelects all elements of a type.- (type)
A, BSelects all A and all B elements.- (group)
A BSelects B inside A (any depth).- (descendant)
A > BSelects B that is a direct child of A.- (child)
A + BSelects B immediately after A.- (adjacent sibling)
A ~ BSelects all B siblings after A.- (general sibling)
:hoverPointer is over the element.- (pseudo-class)
:focusElement has keyboard/click focus.- (pseudo-class)
:activeElement is being activated (clicked).- (pseudo-class)
:visitedLink has been visited.- (pseudo-class)
:first-childFirst child of parent.- (structural)
:last-childLast child of parent.- (structural)
:nth-child(n)Selects by index or formula.n | even | odd | formula
:not(selector)Elements not matching selector.- (negation)
:is(A, B)Matches any selector in the list (reduces specificity).- (matches)
:where(A, B)Like :is() but has zero specificity.- (zero-specificity)
:has(B)Parent selector: selects A if it contains B.- (relational)
::beforeInserts content before element via content property.- (pseudo-element)
::afterInserts content after element via content property.- (pseudo-element)
::placeholderStyles placeholder text in inputs.- (pseudo-element)
[attr]Selects elements with a given attribute.- (attribute)
[attr=value]Exact attribute value match.- (attribute)
[attr*=value]Attribute contains the value.- (attribute)
[attr^=value]Attribute value starts with.- (attribute)
[attr$=value]Attribute value ends with.- (attribute)

Filters & Effects 4 properties

PropertyDescriptionValues / Syntax
filterApplies graphical effects to an element.blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia()
backdrop-filterApplies filter to content behind element (glassmorphism).blur() | brightness() | ...
mix-blend-modeBlending of element with background.normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | ...
box-shadowAdds shadow to element box. Use inset for inner shadow.x y blur spread color | inset ...

Responsive / Media 7 properties

PropertyDescriptionValues / Syntax
@mediaApplies CSS rules only when condition is met.(max-width: ...) | print | screen | ...
@supportsApplies CSS only if feature is supported.(property: value)
@keyframesDefines animation sequence.from {} to {} | 0% {} 100% {}
@importImports an external stylesheet.url() | 'path'
@font-faceDefines custom font for use in page.font-family: src:
@layerDefines a cascade layer to control specificity order.name { ... }
@containerContainer queries - style based on parent size.(min-width: ...) { }