CSS TutorialLesson #17
Background Image
The `background-image` property specifies an image to use as the background of an element.
CSS background-image
The background-image property specifies an image to use as the background of an element.
By default, the image is repeated so it covers the entire element.
Example
Example Code
cssbody {
background-image: url("paper.gif");
}Example
Example Code
cssbody {
background-image: url("bgdesert.jpg");
}Note: When using a background image, use an image that does not disturb the text.
The background image can also be set for specific elements, like the <p> element:
Example
Example Code
cssp {
background-image: url("paper.gif");
}The CSS Background Image Property
| Property | Description |
|---|---|
| background-image | Sets the background image for an element |
Video: CSS Background Images
Interactive Code Examples
CSS Example 1
cssInteractive runnable CSS example from EA Academy.
Live Output Preview:
CSS Example 2
cssInteractive runnable CSS example from EA Academy.
Live Output Preview:
CSS Example 3
cssInteractive runnable CSS example from EA Academy.
Live Output Preview: