Boxes

Positioning

Dimensions

Miscellaneou

Shorthand properties are markeed with *

CSS Cheat Sheet

The CSS cheat sheet is a one-page reference sheet, listing all selectors (as of CSS 2.1) and properties. It includes a visual example of the box model, unit reference for CSS units and the various media types CSS makes allowance for.

SYNTAX

/* Comment */
@media type{
    selector {
       property:values;
    }
}

(Media type optional)

SELECTORS

Style apply to:
*All elements
div<div>
div *Elements within <div>
div span<span> within <div>
div,span<span> and <div>
div > span<span> with <div> as parent
div + span<span> preceded by <div> ...</div>
.classElements of class "class"
div.class<div>of class "class"
#itemidElements with id "itemid"
div#itemid<div> with id "itemid"
a[class]<a> with class attribute
a[class='x']<a> when class is "x"
a[class~='x']<a> when class is a list of space-seperated values and one of those is "x"
a[lang|='en']<a> when lang begins with "en"

PSEUDO-SELECTORS

Style apply to:
:first-childFirst child of element
:first-lineFirst line of element
:first-letterFirst letter of element
:hoverElement when mouse over
:activeActive element
:focusFocus whit element
:linkNon-active,unvisited links without mouse over.
:visitedVisited links
:lang(lang)Element with text of language "lang"

MEDIA TYPES(@media)

allProjection
braillescreen
embossedspeech
handheldtty
printtv

BOX MODEL

box images

UNITS

pxPixels
em1em equalto font size of parent(same as 100%)
exHeight of lower case "x"
%Percentage
inInches
cmCentimeters
mmMillimeters
pt1pt=1/72in
pc1pc=12pt
#789abcRGB Hex Notation
#acfEquates to "#aaccff"
rgb(0,25,50)Velue (0 to 255) of each of read,green,and blue.May also be percentages
00 requires no unit

PROPERTIES THAT INHERIT

azimuthlist-style
border-collapselist-style-image
border-spacinglist-style-position
caption-sidelist-style-type
colororphans
cursorpage
directionpage-break-inside
empty-cellsquotes
fontspeak
font-familyspeak-header
font-stretchtext-align
font-sizetext-indent
font-size-adjusttext-transform
font-stylevolume
font-variantwhite-space
font-weightwindows
letter-spacingword-spacing
line-height