CSS Examples: background-image

Examples

This is an example of a div with an opaque background image specified. The specified background-color here is white, while the image is blue and yellow.
This is an example of a div with a transparent background image specified. The specified background-color here is pink, while the image is blue with a transparent background.

Styles Used

div {
	margin: 15px;
	height: 100px;
}

.solidimage {
	background-color: #FFF;
	background-image: url("images/starsolid.gif");
}

.transparentimage {
	background-color: #FEE;
	background-image: url("images/startransparent.gif");
}