CSS Cheat Sheet
CSS Cheat Sheet
Shorthand*
background border border-bottom border-left border-right border-top font list-style margin padding S nta selector {property: value; E ternal St le Sheet <link rel="stylesheet" type="text/css" href="style.css" /> Internal St le <style type="text/css"> selector {property: value; </style> Inline St le <tag style="property: value"> border-w idth Width of the border
SYNTAX
BOX MODEL
height; w idth; margin-top; margin-right; margin-bottom; margin-left; padding-top; padding-right; paddingbottom; padding-left;
Comments
/* Comment */
BORDER GENERAL
border-style border-color
dashed; dotted; double; groove; inset; outset; ridge; solid; none
Pseudo Selectors
:hover :active :focus :link :visited :first-line :first-letter
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 position z-index Any floating elements around the element?
both, left, right, none
Media T pes
all braille embossed handheld print projection screen speech tty tv
visibility
visible, hidden
FONT
font-style font-variant font-w eight font-size font-family
Italic, normal normal, small-caps bold, normal, lighter, bolder, integer (100-900)
BACKGROUND
background-color background-image background-repeat background-attachment background-position Background color Background image
repeat, no-repeat, repeat-x, repeat-y
Units
Length % em pt letter-spacing line-height text-align
TEXT
Space betw een letters Vertical distance betw een baselines Horizontal alignment