CSS Shorthand for Backgrounds
Another interesting piece of CSS is that certain properties have a shorthand equivalent. This occurs only with a handful of properties; background is one of them.Shorthand properties combine the features of all related properties. In the case of ackground, this means that color, image, repeat, and attachment can all be combined into one rule using the background property.To help you compare, Example 8-7 describes the styles for all the background properties.
Example 8-7. Longhand background styles
The shorthand version equates to this:
body {
background-color: white;
background-image: url(images/lemon-slice.gif);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: right bottom;
}
I created an HTML page with some mock text and applied the background styles using the shorthand version (see Figure 8-14).
body {background: white url(images/lemon-slice.gif) no-repeat scroll right bottom;}
Figure 8-14. Applying background properties using CSS shorthand.
