Call (877) SITE-OPT (748-3678)

Code: Use shorthand colors

From Chapter 7: CSS Optimization

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).

Copyright © 2002-2018 Website Optimization, LLC. All Rights Reserved - Free website speed test - Privacy Policy
Last modified: February 19, 2009.

Follow us on: Twitter, Google+, Facebook, Linked In