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 background, 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
body { background-color: white; background-image: url(images/lemon-slice.gif); background-repeat: no-repeat; background-attachment: scroll; background-position: right bottom; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access