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

Code: Use property replication

From Chapter 7: CSS Optimization

For CSS properties that can specify values for four sides of a box (border, border-color, margin, padding, outline, etc.), you can use replication to save space. Here is how replication works. If there is one value, it applies to all sides. Two values apply to the top/bottom, and right/left sides. Three values apply to top, right/left, and bottom. For example:

body { margin: 2em; } /* all margins set to 2em */
body { margin: 1em 2em; } /* top & bottom = 1em, right & left = 2em */
body { margin: 1em 2em 3em; } /* top=1em, right & left =2em, bottom=3em */
body { margin: 1em 2em 3em 4em; } /* top = 1em, right=2em, bottom=3em, left=4em */
body { margin: top right bottom left;} /* full syntax */
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