Css Cheat Sheet
Css Cheat Sheet
Property/Selector
Usage
Selectors * Selects all elements
Selectors .classnameSelects elements with that class
Selectors #idname Selects element with that ID
Selectors element Selects all such HTML elements (e.g., p, div)
Selectors element1, Selects multiple elements
Selectors parent > chSelects direct child only
Selectors element + sSelects the next sibling
Text color Text color
Text text-align Aligns text (left, center, right)
Text text-decor Underline, overline, none, etc.
Text text-trans Uppercase, lowercase, capitalize
Text line-heightSpace between lines
Text letter-spacSpace between letters
BackgrounbackgroundSets background color
BackgrounbackgrounSets a background image
BackgrounbackgroundControls image repeating (repeat, no-repeat)
BackgrounbackgroundPositioning of background image
BackgrounbackgroundResize background image (cover, contain)
Border border Shorthand for width, style, and color
Border border-widSets border thickness
Border border-stylSolid, dashed, dotted, etc.
Border border-col Sets color of border
Border border-radRounds the corners
Font font-familyFont type (e.g., Arial, sans-serif)
Font font-size Size of the font
Font font-weighBoldness (normal, bold, lighter, 100-900)
Font font-style Normal or italic
Font font-varianSmall-caps transformation
Font line-heightLine spacing
Table border-col Collapses border spacing (collapse, separate)
Table table-layouFixed or automatic layout
Table caption-sidPosition of caption (top, bottom)
Table empty-cellShow or hide borders on empty cells
Table border-spaSets space between cells (used when separate)
Hyperlink a:link Unvisited link
Hyperlink a:visited Visited link
Hyperlink a:hover Link on hover
Hyperlink a:active Link when clicked
Hyperlink text-decor Underline or remove underline from link
Hyperlink color Sets link color