O'Reilly logo

CSS Quick Syntax Reference by Mikael Olsson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 14

image

Background

The background properties can add background effects. None of these properties inherits and they can be applied to any elements.

background-color

The color of an element’s background is set with the background-color property. By default, its value is set to transparent.

background-color : transparent | <color>

Even if a background image is used, it is a good idea to set a background color. That way, there is a fallback color in case the background image is unavailable for any reason.

background-color: #ccc;

background-image

background-image specifies an image to use as a background with the url function.

background-image ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required