Shortcuts
Grouping
If you have the same style for two or more selectors, you can group them!
p, h1, h2 {
font: 12px Arial, sans-serif;
}
Shorthand properties
I always use shorthand properties to have a lighter stylesheet. For example, if you have background properties set like this:
body {
background-color: #FFF;
background-image: url(image.jpg);
background-repeat: no-repeat;
}
The code can be shortened to one line:
body {
background: #FFF url(image.jpg) no-repeat;
}
Sponsors
One Response to “Shortcuts”
Leave a Comment
Works? Doesn't work? Other tips? Please leave a comment! :)
To add to this list here's the shortcut for font :-
font:normal 12px verdana;
this will set the font-weight:normal; font-size:12px; font-family:verdana;