Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 841
Maar Yaam Avatar asked Nov 11 '11 23:11

Maar Yaam


1 Answers

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

like image 177
GregM Avatar answered Sep 25 '22 02:09

GregM