Entries from February 2008

February 21, 2008

CSS shorthand

Background
background-color:#fff;
background-image:url(background.gif);
background-repeat:no-repeat;
background-position:top left;
Woh… it’s too long, take a look at this.
background:#fff url(background.gif) no-repeat top left;
Font
font-size:1em;
line-height:2em;
font-weight:bold;
font-style:italic;
font-family:arial;
Shorthand:
font:1em/2em bold italic serif;
Margin & padding
There are different shorthand properties for margin & padding.
Four different values
margin-top:10px;
margin-right:5px;
margin-bottom:15px;
margin-left:20px;
shorthand:
margin:10px 5px 15px 20px; (top, right, bottom, left)
Three different values
margin-top:10px;
margin-right:5px;
margin-bottom:15px;
margin-left:5px;
shorthand:
margin:10px 5px 15px; (top, right and left, bottom)
Two different values
margin-top:10px;
margin-right:20px;
margin-bottom:10px;
margin-left:20px;
shorthand:
margin:10px 20px; (top and bottom, right and left)
One value
margin-top:10px;
margin-right:10px;
margin-bottom:10px;
margin-left:10px;
shorthand:
margin:10px; [...]