10/29/11

CSS Cheat Sheet

Source: http://www.addedbytes.com/cheat-sheets/css-cheat-sheet/


CSS2 Cheat Sheet by DaveChild

CSS2 Selectors

*All elements
div<div>
div *All elements within <div>
div span<span> within <div>
div, span<div> and <span>
div > span<span> with parent <div>
div + span<span> preceded by <div>
.classElements of class "class"
div.class<div> of class "class"
#itemidElement with id "itemid"
div#itemid<div> with id "itemid"
a[attr]<a> with attribute "attr"
a[attr='x']<a> when "attr" is "x"
a[class~='x']<a> when class is a list containing 'x'
a[lang|='en']<a> when lang begins "en"

CSS2 Pseudo Selectors and Pseudo Classes

:first-childFirst child element
:first-lineFirst line of element
:first-letterFirst letter of element
:hoverElement with mouse over
:activeActive element
:focusElement with focus
:linkUnvisited links
:visitedVisited links
:lang(var)Element with language "var"
:beforeBefore element
:afterAfter element

CSS2 Sizes

00 requires no unit
Relative Sizes
em1em equal to font size of parent (same as 100%)
exHeight of lower case "x"
%Percentage
Absolute Sizes
pxPixels
cmCentimeters
mmMillimeters
inInches
pt1pt = 1/72in
pc1pc = 12pt

CSS2 Colours

#789abcRGB Hex Notation
#acfEquates to "#aaccff"
rgb(0,25,50)Value of each of red, green, and blue. 0 to 255, may be swapped for percentages.
 

CSS2 Box Model

CSS2 Positioning

displayclear
positionz-index
topdirection
rightunicode-bidi
bottomoverflow
leftclip
floatvisibility

CSS2 Dimensions

widthmin-height
min-widthmax-height
max-widthvertical-align
height

CSS2 Colour and Background

colorbackground-repeat
backgroundbackground-image
background-colorbackground-position
background-attachment

CSS2 Text

text-indentword-spacing
text-aligntext-transform
text-decorationwhite-space
text-shadowline-height
letter-spacing

CSS2 Fonts

fontfont-weight
font-familyfont-stretch
font-stylefont-size
font-variantfont-size-adjust
 

CSS2 Boxes

marginborder-color
margin-topborder-top-color
margin-rightborder-right-color
margin-bottomborder-bottom-color
margin-leftborder-left-color
paddingborder-style
padding-topborder-top-style
padding-rightborder-right-style
padding-bottomborder-bottom-style
padding-leftborder-left-style
borderborder-width
border-topborder-top-width
border-bottomborder-right-width
border-rightborder-bottom-width
border-leftborder-left-width

CSS2 Tables

caption-sideborder-spacing
table-layoutempty-cells
border-collapsespeak-header

CSS2 Paging

sizepage-break-inside
markspage
page-break-beforeorphans
page-break-afterwidows

CSS2 Interface

cursoroutline-style
outlineoutline-color
outline-width

CSS2 Aural

volumeelevation
speakspeech-rate
pausevoice-family
pause-beforepitch
pause-afterpitch-range
cuestress
cue-beforerichness
cue-afterspeak-punctuation
play-duringspeak-numeral
azimuth

CSS2 Miscellaneous

contentlist-style-type
quoteslist-style-image
counter-resetlist-style-position
counter-incrementmarker-offset
list-style


No comments:

Quick HTTP to HTTPS - Apache2

There are several methods for redirecting your Apache-based website visitors who might type your servers URL using the plain (non-secure) HT...