MaggsWeb:7

www.maggsweb.com

CSS Shorthand

June 16, 2007 | Comments | CSS

Reducing the file size and physical size of CSS files

 
#div{
 
	border-bottom-width: 	1px;
	border-bottom-style: 	solid;
	border-bottom-color: 	#cccccc;
 
	/*  could be reduced to:  */
 
	border-bottom: 1px solid #ccc;
	/*(or simillarly with 'border-top', 'border-left', or even just 'border')*/
 
       /* --------------------------------------------------------------*/
 
	background-color: 	#FDFDF2;
	background-image: 	url(/images/fade.jpg);
	background-repeat: 	repeat-x;
 
	/*  could be reduced to:  */
 
	background: #FDFDF2 url(/images/fade.jpg) repeat-x;
 
        /* --------------------------------------------------------------*/
 
	font-weight: bold;
	font-style: italic;
	font-size: 1em;
	line-height: 1.5em;
	font-family: verdana,sans-serif
 
        /*  could be reduced to:  */
 
	font: bold italic 1em/1.5em verdana,sans-serif
 
}

NB: The font-family command must always be at the very end of the ‘font:’ shorthand command, and font-size must come directly before it.

Write a Comment

Let me know what you think?