CSS properties A to Z

CSS properties A to Z: 81 terms, each with what it does and a link to its full page.

Updated

A property is one thing about an element that CSS can change: its color, its size, the space around it, how its children line up. You write the property, a colon and a value: color: navy.

Here is every CSS property in the glossary, A to Z, with an example of how it's written in the Syntax column. Pick a letter to jump down the list, or pick a property to read its full page.

TermSyntaxWhat it does
A
Align contentalign-content: space-betweenSpaces out the rows of wrapped items.
Align itemsalign-items: centerLines items up along the cross axis, like centered.
Align selfalign-self: flex-endLets one item align differently from the others.
all propertyall: unsetResets every property of an element at once.
Animation fill modeanimation-fill-mode: forwardsDecides what an element looks like before and after an animation.
Animation iteration countanimation-iteration-count: 3Sets how many times an animation plays.
Animation nameanimation-name: fade-inPicks which @keyframes animation to play.
Aspect ratioaspect-ratio: 16 / 9Keeps width and height in proportion, like 16/9.
B
Background colorbackground-color: tomatoFills an element's background with a color.
Background imagebackground-image: url("beach.jpg")Puts an image or gradient behind an element's content.
Background positionbackground-position: centerSets where a background image sits.
Background repeatbackground-repeat: no-repeatDecides whether a background image tiles.
Background sizebackground-size: coverSets how big a background image is, like cover.
Borderborder: 1px solid grayDraws a line around an element: width, style, color.
Border radiusborder-radius: 8pxRounds an element's corners.
Box shadowbox-shadow: 0 2px 6px grayDraws a shadow around an element.
Box sizingbox-sizing: border-boxDecides whether width includes padding and border.
C
Clearclear: bothMoves an element below any floats instead of wrapping around them.
Colorcolor: navyThe color property sets text color; colors can be names, hex or rgb().
Column countcolumn-count: 3Sets how many columns text flows into.
Column spancolumn-span: allMakes an element stretch across all the columns.
Column widthcolumn-width: 200pxSets an ideal column width; the browser fits as many as it can.
contain-intrinsic-sizecontain-intrinsic-size: auto 500pxA placeholder size for skipped content, so scrolling doesn't jump.
Container namecontainer-name: sidebarNames a query container so queries can target it.
Container typecontainer-type: inline-sizeTurns an element into a query container.
content-visibilitycontent-visibility: autoLets the browser skip rendering off-screen sections.
D
display: nonedisplay: noneHides an element completely; it takes no space.
F
Flex basisflex-basis: 200pxA flex item's starting size before growing or shrinking.
Flex directionflex-direction: columnSets whether flex items run in a row or a column.
Flex flowflex-flow: row wrapSets flex-direction and flex-wrap together.
Flex growflex-grow: 1How much leftover space a flex item takes.
Flex shorthandflex: 1 1 200pxSets grow, shrink and basis at once, like flex: 1.
Flex shrinkflex-shrink: 0How much a flex item shrinks when space is short.
Flex wrapflex-wrap: wrapLets flex items wrap onto new lines instead of squashing.
Floatfloat: leftPushes an element left or right with text wrapping around it.
Font familyfont-family: Georgia, serifPicks the typeface, with fallbacks.
Font sizefont-size: 1.25remSets how big the text is.
Font weightfont-weight: boldSets how thick the text is, like bold or 700.
G
Gapgap: 16pxSets the space between flex or grid items.
Grid areagrid-area: sidebarA rectangle of grid cells, often named.
Grid auto flowgrid-auto-flow: denseDecides how unplaced items fill the grid.
Grid template areasgrid-template-areas: "head head"Draws a grid layout with named areas, row by row.
Grid template columnsgrid-template-columns: 1fr 2frSets a grid's columns and their widths.
Grid template rowsgrid-template-rows: auto 1frSets a grid's rows and their heights.
H
Heightheight: 300pxSets how tall an element is.
I
Insetinset: 0Sets top, right, bottom and left at once.
J
Justify contentjustify-content: space-betweenSpreads items along the main axis: start, center, space-between.
L
Letter spacingletter-spacing: 0.05emAdds or removes space between letters.
Line heightline-height: 1.5Sets the space between lines of text.
List stylelist-style: noneSets or removes list bullets and numbers.
M
Marginmargin: 0 autoSpace outside an element's border that pushes neighbors away.
Maximum sizemax-width: 600pxmax-width and max-height stop an element growing past a size.
Minimum sizemin-width: 120pxmin-width and min-height stop an element getting smaller than a size.
O
object-fitobject-fit: coverDecides how an image fills its box, like cover or contain.
Opacityopacity: 0.5Makes an element see-through, from 0 to 1.
Orderorder: 2Changes the visual order of items without changing the HTML.
Outlineoutline: 2px solid blueA line around an element that takes up no space, used for focus rings.
Overflowoverflow: hiddenDecides what happens when content doesn't fit: show, hide or scroll.
P
Paddingpadding: 16pxSpace inside an element, between its content and border.
Place contentplace-content: centerSets align-content and justify-content together.
Place itemsplace-items: centerSets align-items and justify-items together.
Place selfplace-self: endSets align-self and justify-self together for one item.
R
Rotaterotate: 45degTurns an element around a point.
S
Scalescale: 1.2Makes an element look bigger or smaller.
Scroll marginscroll-margin-top: 80pxLeaves space around an element when scrolled to it.
Scroll paddingscroll-padding-top: 80pxSpace inside a scroll area that scrolled-to items stay clear of.
T
Text alignmenttext-align: centerLines text up left, right or center.
Text decorationtext-decoration: underlineAdds or removes lines on text, like underlines.
Text transformtext-transform: uppercaseChanges how text is capitalized when shown.
Transformtransform: rotate(45deg)Moves, rotates or scales an element without affecting layout.
Transform origintransform-origin: top leftSets the point an element rotates or scales around.
Transitiontransition: color 0.3s easeMakes a property change smoothly instead of jumping.
Transition durationtransition-duration: 0.3sSets how long a transition takes.
Transition propertytransition-property: opacitySays which properties animate when they change.
Translatetranslate: 10px 20pxSlides an element from where it sits.
V
Visibilityvisibility: hiddenMakes an element invisible but keeps its space.
W
White spacewhite-space: nowrapControls how spaces and line breaks are shown, and wrapping.
Widthwidth: 50%Sets how wide an element is.
will-changewill-change: transformWarns the browser a property is about to animate.
Writing modewriting-mode: vertical-rlSets which way text flows: across or down.
Z
Z-indexz-index: 10Decides which overlapping elements sit in front.

Every CSS term, by level