CSS Shorthand Properties
July 7, 2008 at 5:56 pm Leave a comment
If you are working on CSS then may or may not be you using CSS shorthand properties, if you are not using then start using becuase it’s give a less code to your stylesheet and deifnately you learning new way to write CSS 🙂
FONT
start using:
.fontSample{font: normal italic 1em/1.2em Arial, Helvetica, sans-serif;}
instead of:
.fontSample{
font-weight: normal;
font-style: italic;
font-size: 1em;
line-height: 1.2em;
font-family: Arial, Helvetica, sans-serif;
}
BACKGROUND
start using:
.backgroundSample{background: #CCCCCC url(logo.png) left top no-repeat fixed;}
insted of:
.backgroundSample{
background-color: #CCCCCC;
background-image: url(logo.png);
background-position: left top;
background-repeat: no-repeat;
background-attachment: fixed;}
MARGIN & PADDING
Start Using:
.marginSample{margin: 0 10px 20px 10px;}
Instead of:
.marginSample{
margin-top: 0;
margin-right: 10px;
margin-bottom: 20px;
margin-left: 10px;
}
It’s work margin (top, right, bottom, left)
Same for padding others too will discuss in couple of days start using these 🙂
Entry filed under: CSS & JavaScript.
Trackback this post | Subscribe to the comments via RSS Feed