CSS Cheat Sheet
CSS Cheat Sheet
SYNTAX
Syntax selector {property: value;} External Style Sheet <link rel="stylesheet" type="text/css" href="style.css" /> Internal Style <style type="text/css"> selector {property: value;} </style> Inline Style
BOX MODEL
height; w idth; margin-top; margin-right; marginbottom; margin-left; padding-top; padding-right; padding-bottom; paddingleft;
BORDER
borderw idth borderstyle bordercolor Width of the border
dashed; dotted; double; groove; inset; outset; ridge; solid; none
Comments
/* Comment */
Pseudo Selectors
:hover :active :focus :link :visited :first-line :first-letter
GENERAL
Class ID div span color cursor display String preceded by a period String preceded by a hash mark Formats structure or block of text Inline formatting Foreground color Appearance of the cursor
block; inline; list-item; none
POSITION
clear float left top Any floating elements around the element?
both, left, right, none
Media Types
all braille embossed handheld print projection screen speech tty tv
visibility
visible, hidden
FONT
fontstyle fontvariant fontw eight
Italic, normal normal, small-caps bold, normal, lighter, bolder, integer (100-900)
position static, relative, absolute z-index Element above or below overlapping elements?
auto, integer (higher numbers on top)
BACKGROUND
background-color background-image background-repeat backgroundattachment Background color Background image
repeat, no-repeat, repeat-x, repeat-y
Units
Length % em pt px Keyw ords bolder lighter larger
TEXT
letterspacing line-height text-align textdecoration text-indent texttransform verticalalign w ordspacing Space betw een letters Vertical distance betw een baselines Horizontal alignment
blink, line-through, none, overline, underline
LIST
list-style- Type of bullet or numbering in the list type disc; circle; square; decimal; lower-roman; upperroman; lower-alpha; upper-alpha; none
list-style- Position of the bullet or number in a list position inside; outside list-style- Image to be used as the bullet in a list image
* The properties for each selector are in the order they should appear when using shorthand notation.
lesliefranke.com//csscheatsheet.html
1/1