CSS Cheat Sheet

Text Color

color: green;

Set Background Color

background-color: black;

Repeat Background Image Horizontally

background: white url("/images/bk.gif") repeat-x;

Repeat Background Image Vertically

background: white url("/images/bk.gif") repeat-y;

Remove Underline from a Link

a { text-decoration:none; }

Bold

font-weight: bold;

Italic

font-style: italic;

Underline

text-decoration: underline;

All Uppercase

text-transform: uppercase;

Capitalize First Letter Of Each Word

text-transform: capitalize;

Add a margin

margin-top: 5px;
margin-right: 10px;
margin-bottom: 15px;
margin-left: 20px;

Or use shortcut (clockwise start at 12):

margin: 5px 10px 15px 20px;

Padding

padding-top: 5px;
padding-right: 10px;
padding-bottom: 5px;
padding-left: 10px;

Shortcut

padding: 5px 10px 5px 10px;

Shorter Cut (if top and bottom & left right same):

padding: 5px 10px;

If you like cheat sheets, you might also like my Regex Cheat Sheet.

CSS CheatSheet
© 2005 Pete Freitag