WeCodeAcademy

CSS Properties

The CSS properties you will use most, with syntax and a live example.

77 of 77
PropertyGroupDescription
colorTextSets the text colour.
background-colorBackgroundSets the background colour.
background-imageBackgroundSets a background image or gradient.
background-sizeBackgroundSizes the background image.
background-repeatBackgroundControls repeating of the background image.
opacityColourSets how transparent an element is (0 to 1).
font-familyTextSets the typeface.
font-sizeTextSets the text size.
font-weightTextSets how bold text is.
font-styleTextMakes text italic or normal.
line-heightTextSets the space between lines.
letter-spacingTextSets the space between letters.
word-spacingTextSets the space between words.
text-alignTextAligns text horizontally.
text-decorationTextAdds underline, overline or line-through.
text-transformTextChanges letter case.
text-indentTextIndents the first line.
text-shadowTextAdds a shadow to text.
white-spaceTextControls how white space is handled.
overflow-wrapTextLets long words break.
widthBoxSets the width of an element.
heightBoxSets the height of an element.
min-widthBoxSets the minimum width.
max-widthBoxSets the maximum width.
paddingBoxSpace inside the border.
marginBoxSpace outside the border.
borderBoxSets width, style and colour of the border.
border-radiusBoxRounds the corners.
box-shadowBoxAdds a shadow around an element.
box-sizingBoxChooses what width and height include.
outlineBoxA line drawn outside the border.
displayLayoutSets how an element is laid out.
visibilityLayoutHides an element but keeps its space.
positionLayoutSets the positioning method.
topLayoutOffsets a positioned element from the top.
leftLayoutOffsets a positioned element from the left.
z-indexLayoutSets the stacking order.
floatLayoutFloats an element left or right.
clearLayoutStops wrapping around floats.
overflowLayoutControls content that does not fit.
cursorInteractionSets the mouse pointer shape.
pointer-eventsInteractionLets an element ignore the mouse.
user-selectInteractionControls text selection.
flexFlexboxShorthand for how a flex item grows and shrinks.
flex-directionFlexboxSets the main axis of a flex container.
flex-wrapFlexboxLets flex items wrap onto new lines.
justify-contentFlexboxAligns items along the main axis.
align-itemsFlexboxAligns items along the cross axis.
align-selfFlexboxOverrides align-items for one item.
gapFlexboxSets the space between flex or grid items.
orderFlexboxChanges the visual order of a flex or grid item.
grid-template-columnsGridDefines the columns of a grid.
grid-template-rowsGridDefines the rows of a grid.
grid-columnGridPlaces an item across grid columns.
grid-areaGridNames or places a grid area.
place-itemsGridAligns grid items on both axes.
transitionAnimationAnimates changes between states.
transformAnimationMoves, rotates, scales or skews.
animationAnimationRuns a keyframe animation.
filterEffectsApplies effects like blur or grayscale.
list-styleListsSets the bullet or number style of lists.
border-collapseTablesMerges table borders.
object-fitImagesHow an image fills its box.
aspect-ratioLayoutKeeps a box at a ratio of width to height.
contentPseudoGenerated content for ::before and ::after.
var()VariablesReads a CSS custom property.
calc()FunctionsCalculates a value.
clamp()FunctionsA value that stays between a minimum and maximum.
@mediaAt-rulesApplies styles only when conditions match.
@keyframesAt-rulesDefines the steps of an animation.
@font-faceAt-rulesLoads a custom font.
scroll-behaviorInteractionSmooth scrolling for anchor links.
resizeInteractionLets the user resize an element.
column-countLayoutSplits text into columns.
vertical-alignTextAligns inline content vertically.
accent-colorColourColours form controls.
mix-blend-modeEffectsBlends an element with what is behind it.