Home·CSS properties

A reference of 154 CSS properties

What each property does, the values people actually use, and whether it is inherited — one line each.

Layout11

Properties that decide what kind of box an element is and what happens when it overflows.

Flexbox and grid24

Properties that line elements up and seat them in a grid — most layout today is one of these two.

flex-directionSets whether flex items run in a row or a column.flex-wrapDecides whether items wrap onto a new line when they run out of room.flexSets how leftover space is shared in one go; flex: 1 splits it evenly.flex-growHow much of the leftover space this item takes.flex-shrinkHow much the item shrinks when space runs short; 0 keeps it fixed.flex-basisThe starting size before growing or shrinking.justify-contentDistributes items along the main axis.align-itemsAligns items along the cross axis; center is the usual vertical centring.align-selfOverrides the alignment for a single item.align-contentSpaces the lines themselves when items wrap onto several rows.gapThe space between items — unlike margins, none is added on the outside.row-gapSets only the space between rows.column-gapSets only the space between columns.orderChanges the visual order without touching the HTML order.grid-template-columnsDefines how many columns the grid has and how wide each is.grid-template-rowsDefines how many rows the grid has and how tall each is.grid-template-areasNames grid areas so the layout can be written out like a picture.grid-columnSets how many columns an item spans.grid-rowSets how many rows an item spans.grid-auto-flowDecides which way unplaced items fill the grid.grid-auto-rowsSets the height of rows the grid creates automatically.place-itemsSets both axes of alignment at once; a single center centres everything.place-contentPositions the whole block of content on both axes.justify-itemsPlaces items horizontally inside their own cells.

Box and spacing16

Size and spacing. Outer margins collapse into each other; inner padding is painted by the background.

Text25

Typeface, line spacing, alignment — how the text reads. Most of these are inherited.

font-sizeThe text size; rem multiplies the root size, so it follows the reader’s zoom setting.font-familySets the typeface; the browser falls through the list, so end with a generic family.font-weightThe stroke weight; 400 is regular and 700 is bold.font-styleTurns italics on or off.fontSets several font values at once; anything omitted resets to its default.line-heightThe line spacing; a unitless value such as 1.5 inherits more safely.letter-spacingThe space between letters; tightening it slightly suits large headings.word-spacingThe space between words.text-alignAligns text horizontally.text-decorationAdds underlines or strike-throughs; also how you remove a link’s default underline.text-decoration-lineChooses which decoration line is drawn.text-decoration-colorColours that decoration line on its own.text-decoration-styleSets the line style; wavy gives the squiggle used by spellcheckers.text-transformForces the letter case for display only; the underlying text is untouched.text-indentIndents the first line of a block.text-overflowTrims overflowing text with an ellipsis; needs overflow and nowrap alongside it.text-shadowCasts a shadow behind text — useful for white type on a busy photo.white-spaceControls how spaces and line breaks are handled; nowrap keeps everything on one line.word-breakDecides where long words may break; keep-all stops Korean words splitting mid-word.overflow-wrapForces very long unbreakable strings to wrap — handy for long URLs.writing-modeChanges the direction text flows — this is how vertical writing is done.vertical-alignAligns an inline box vertically within its line; also works in table cells.font-variant-numericPicks a numeral style; tabular-nums keeps digits the same width so tables stop jittering.hyphensAllows words to break with a hyphen at line ends; needs the language to be declared.text-wrapChooses how lines break; balance evens out the line lengths of a heading.

Colour and background13

Text colour, background colour, gradients and transparency.

Borders13

Borders, corners and shadows. An outline takes up no space of its own.

Effects7

Effects applied after everything is painted — blurring, clipping, filling.

Transform and motion14

Moving, rotating and easing. These leave the layout untouched, so nothing else jumps.

Positioning7

Lifting an element out of the flow and placing it; z-index decides what sits in front.

Tables4

Properties for table borders and column widths.

Lists4

The shape and placement of list markers.

Interaction9

How the element answers the mouse, the finger and the scroll.

Print and misc7

The rest — printing, generated content and automatic numbering.

How to read this

  • An inherited property only needs writing once on the parent — every child picks it up. Most text properties work this way.
  • A shorthand resets whatever you leave out. Writing background: red alone also wipes a background image you set earlier.
  • When rules collide, the more specific selector wins; only when specificity ties does source order decide.
  • Animate transform and opacity for smoothness. Changing width or top forces the layout to be recalculated.

Frequently asked questions

Q. How many CSS properties are there?

The standard lists well over 500, but only a fraction come up in daily work. This reference covers the 154 you end up writing again and again, grouped by purpose.

Q. What does inherited mean?

It means the value passes down: set it on the parent and children use it without repeating it. Most text-related properties inherit; spacing and borders do not.

Q. What changes when I use a shorthand?

You set several values in one line, but anything you leave out resets to its default. That is why background: red on its own also wipes a background image you had set.

Q. If the same property is set twice, which wins?

Specificity is checked first: an id beats a class, a class beats a tag. Only when specificity ties does the later rule win. !important overrides all of that, which is why it is best avoided.

Q. Should I use px or rem?

A rem is a multiple of the root font size, so it grows when the reader enlarges text in the browser. Use rem for type and spacing; px is fine where a value must never change, such as a hairline border.