• Article Written 
  • on 17.07.2009
  •  at 12:21 PM
  •  by admin

5 Tips and Tricks How to Optimize Your Css

In this article we will find that how to optimize Css.This is very simple and basic tips for the web designers and developers. Not only will these tips help reduce the file size of your CSS file, but they’ll also speed up your coding if you prefer to do some of your CSS by hand.

1. Use CSS Shorthand


Before
p {
margin-top: 5px;  
margin-right: 10px;  
margin-bottom:  15px;  
margin-left: 20px;
}
After
p{ margin:5px 10px 15px 20px;}

2. Remove Unnecessary Whitespace


Before
.wrap
{
width:900px;

height:100%;

margin:0px;

padding:0px;

background-color:#cccccc;
}
After
.wrap
{ width:900px; height:100%; margin:0px; padding:0px;}

3. Use shorthand colors

Longhand hex colors are specified as three red, green, and blue triplets, like this:

p { color: #fdca30; }

You can abbreviate colors that have an identical value for each pair, that is, #rrggbb;, with only one value per pair, so this:

p { color: #ffcc00; }

becomes this, using shorthand hex notation:

p {color: #fc0;}

Named colors can ease maintenance, but they are generally longer than their shorthand hex equivalents (other than red and tan).

4. Use Descendant Selectors

div.warning p{color:red;}
<div class="warning">
    <p>Warning! Meltdown is imminent.</p>
</div>

5. Use Css CompressTools

if you don’t want to waste your time in modifying your old style sheets you can simply use online css compress tools, it make your work in seconds
check this online css compress tools…
Css Tidy
Clean Css
Css Optimiser
Flumpcakes Css optimizer
cssdrive Css Comperasor
W3C Css Validator

Promote Us

  • Add to Mixx!
Ace Hosting India

Tags: ,

Untitled Document

Submit a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled