Maar Yaam
Maar Yaam

Reputation: 105

Display Background Color through Transparent Background Image

I have an div element in the web page and I'm going to set both background color and background image for it. The image has a transparent background, and I want the background color to be shown under the image. Is it possible?

Upvotes: 5

Views: 17217

Answers (1)

GregM
GregM

Reputation: 2654

Yeah you only need to have an image with a transparent background and after that you use this

body {background:#ffffff url('img_tree.png') no-repeat right top;}

the #ffffff is the color that you want behind your image.

Very important that your image extension support transparency, use .png or .gif

Upvotes: 16

Related Questions