Css Cheat Sheet: Shorthand
Css Cheat Sheet: Shorthand
Shorthand*
background border border-bottom border-left border-right border-top font list-style margin padding 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 <tag style="property: value"> borderw idth borderstyle bordercolor
SYNTAX
BOX MODEL
height; w idth; margin-top; margin-right; marginbottom; margin-left; padding-top; padding-right; padding-bottom; paddingleft;
Comments
/* Comment */
BORDER
Width of the border
dashed; dotted; double; groove; inset; outset; ridge; solid; none
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 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.