{"id":1104,"date":"2009-07-17T12:21:53","date_gmt":"2009-07-17T12:21:53","guid":{"rendered":"http:\/\/aceinfowayindia.com\/blog\/?p=1104"},"modified":"2018-06-23T00:58:17","modified_gmt":"2018-06-23T00:58:17","slug":"5-tips-and-tricks-how-to-optimize-your-css","status":"publish","type":"post","link":"http:\/\/aceinfowayindia.com\/blog\/2009\/07\/5-tips-and-tricks-how-to-optimize-your-css\/","title":{"rendered":"5 Tips and Tricks How to Optimize Your Css"},"content":{"rendered":"<p>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\u2019ll also speed up your coding if you prefer to do some of your CSS by hand.<br \/>\n<!--more--><\/p>\n<h2>1. Use CSS Shorthand<\/h2>\n<pre>\r\n\r\n<strong>Before<\/strong>\r\n[code lang=\"css\"]\r\np {\r\nmargin-top: 5px;  \r\nmargin-right: 10px;  \r\nmargin-bottom:  15px;  \r\nmargin-left: 20px;\r\n}  \r\n[\/code]\r\n<strong>After<\/strong>\r\n[code lang=\"css\"]\r\np{ margin:5px 10px 15px 20px;}\r\n[\/code]\r\n<\/pre>\n<h2>2. Remove Unnecessary Whitespace <\/h2>\n<pre>\r\n\r\n<strong>Before<\/strong>\r\n[code lang=\"css\"]\r\n.wrap\r\n{\r\nwidth:900px;\r\n\r\nheight:100%;\r\n\r\nmargin:0px;\r\n\r\npadding:0px;\r\n\r\nbackground-color:#cccccc;\r\n}\r\n[\/code]\r\n<strong>After<\/strong>\r\n[code lang=\"css\"]\r\n.wrap\r\n{ width:900px; height:100%; margin:0px; padding:0px;}\r\n[\/code]\r\n<\/pre>\n<h2>3. Use shorthand colors<\/h2>\n<p>Longhand hex colors are specified as three red, green, and blue triplets, like this:<\/p>\n<p>[code lang=&#8221;css&#8221;]<br \/>\np { color: #fdca30; }<br \/>\n[\/code]<\/p>\n<p>You can abbreviate colors that have an identical value for each pair, that is, #rrggbb;, with only one value per pair, so this:<\/p>\n<p>[code lang=&#8221;css&#8221;]<br \/>\np { color: #ffcc00; }<br \/>\n[\/code]<\/p>\n<p>becomes this, using shorthand hex notation:<\/p>\n<p>[code lang=&#8221;css&#8221;]<br \/>\np {color: #fc0;}<br \/>\n[\/code]<\/p>\n<p>Named colors can ease maintenance, but they are generally longer than their shorthand hex equivalents (other than red and tan).<\/p>\n<h2>4. Use Descendant Selectors<\/h2>\n<p>[code lang=&#8221;css&#8221;]<br \/>\ndiv.warning p{color:red;}<br \/>\n[\/code]<\/p>\n<p>[code lang=&#8221;htmlstrict&#8221;]<\/p>\n<div class=\"warning\">\n<p>Warning! Meltdown is imminent.<\/p>\n<\/div>\n<p>[\/code]<\/p>\n<h2>5. Use Css CompressTools<\/h2>\n<p>if you don\u2019t 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<br \/>\ncheck this online css compress tools\u2026<br \/>\n<a href=\"http:\/\/csstidy.sourceforge.net\">Css Tidy<\/a><br \/>\n<a href=\"http:\/\/cleancss.com\">Clean Css<\/a><br \/>\n<a href=\"http:\/\/cssoptimiser.com\">Css Optimiser<\/a><br \/>\n<a href=\"http:\/\/flumpcakes.co.uk\/css\/optimiser\/\">Flumpcakes Css optimizer<\/a><br \/>\n<a href=\"http:\/\/cssdrive.com\/index.php\/main\/csscompresssor\/\">cssdrive Css Comperasor<\/a><br \/>\n<a href=\"http:\/\/jigsaw.w3.org\/css-validator\/\">W3C Css Validator<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019ll also &hellip; <a href=\"http:\/\/aceinfowayindia.com\/blog\/2009\/07\/5-tips-and-tricks-how-to-optimize-your-css\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,56],"tags":[52,23],"class_list":["post-1104","post","type-post","status-publish","format-standard","hentry","category-css","category-tutorials","tag-css","tag-tutorials"],"_links":{"self":[{"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/posts\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/comments?post=1104"}],"version-history":[{"count":16,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/posts\/1104\/revisions"}],"predecessor-version":[{"id":1141,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/posts\/1104\/revisions\/1141"}],"wp:attachment":[{"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/media?parent=1104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/categories?post=1104"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/aceinfowayindia.com\/blog\/wp-json\/wp\/v2\/tags?post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}