This is a summarized form of the CSS Tutorial.
For reference this is the CSS2 Specification .
<link rel="stylesheet" type="text/css" href="style.css" />
CSS syntax is made up of three parts - selector {property: value}.
h1,h2,h3 { text-align: center; color: black; font-family: "sans serif" }
input[type="text"] {background-color: blue} #id {background-color: blue} p#id {background-color: blue}
background-color: black; background-image: url('bg.jpg'); background-repeat: repeat-[x|y]/no-repeat/repeat; background-attachment: fixed background-position: center/30% 20%/50px 100px; background: blue url('bg.gif') no-repeat fixed center;
color: #00ff00/green/rgb(0,255,0) ; text-shadow:blue; text-align: left/right/center/justify ; text-indent: 1cm; letter-spacing: 0.5cm/-3px ; line-height: 200%; white-space: nowrap ; word-spacing: 30px text-decoration: overline/line-through/underline/blink/none text-transform: uppercase/lowercase/capitalize
font-family: times/sans-serif ; font-size: 130% font-size-adjust: 0.60 ; font-variant: small-caps font-style: italic/oblique ; font-stretch: wider font-weight: bold/900 font: italic small-caps 900 12px arial font: caption/icon/menu/message-box/small-caption/status-bar
border-style: medium/solid/double/groove/dotted/ dashed/inset/outset; border-btlr: width style color ; border-btlr-style border-width:5px ; border-btlr-width: thick border-color: color x 4; border-btlr-color outline-color/style/width ; outline:color style width
margin: width x 4 (trbl); margin-btlr padding: width x 4 (trbl); padding-btlr
list-style-type: disc/circle/square/none list-style-type: lower/upper-roman/alpha / decimal list-style-image: url('a.gif') list-style-position: inside/outside list-style: type position image
table-layout: automatic/fixed; border-collapse:collapse/separate; empty-cells:show/hide border-spacing: width x 2;caption-side: btlr
height/width: auto/50%/100px min/max-height/width:none/50%/100px line-height: normal/100px/1/50%
display: inline/none/block (lots of others) float: btlr ; position: relative(to normal)/absolute(rel to block) /fixed(rel to window, doesn't move)/static(normal) ; bottom/top/left/right: +/-100px/width vertical-align:top/bottom/text-top/text-bot/sub/super
visibility:visible/hidden/collapse (for table elems) clear:left/right/both/none (where floats aren't allowed) clip: rect(10px, 5px, 10px, 5px) overflow:auto/scroll/visible/hidden z-index: 1 (0 is normal)
selector.class:pseudo-class {property: value} a:link {color: #FF0000} (unvisited link) a:visited {color: #00FF00} (visited link) a:hover {color: blue} (mouse-over element) a:active {color: #0000FF} (selected element) a:focus {color: #0000FF} (focused element - not in IE) p:first-child {font-weight:bold} p > em:first-child { } ; p:first-child em { }
p:first-letter {} ; p:first-line {} ; h1:before {} ; h1:after {} ;
@media screen,print { p {color:blue} }
opacity:0.4; (for firefox) filter:alpha(opacity=40) (for IE) onmouseover="this.style.opacity=1; this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4; this.filters.alpha.opacity=40" cursor:deflt/cursor/pointer/move/wait/help/text/crosshair