HTML and CSS Reference
In-Depth Information
Figure 8-21.
The background-clip property controls the extent of the background
Background images appear in front of the background color. So, the image hides the color if you add a
background color to the
<div>
elements in background-clip.html. However, when
background-clip
is set to
content-box
, the padding inherits the background color of the parent element rather than the color set on the
element itself.
In background-clip_bg.html, the dark red background color of the
<div>
is hidden, but the light gray
background of the
<body>
shows through the padding between the text and the border. Even in glorious
monochrome, you should be able to see the padding and
<body>
are the same shade in Figure
8-22
.
Figure 8-22.
The parent's background color shows through the padding