background transparency in css

14,356

Use RGBa (with an RGB fallback) colours with the opacity set there. This will just do the background - http://jsfiddle.net/spacebeers/rCGJH/13/

/* Fallback for web browsers that doesn't support RGBa */
background: rgb(0, 0, 0);
/* RGBa with 0.5 opacity */
background: rgba(0, 0, 0, 0.5);

Otherwise just use an image with the opacity set on there. That would cover all browsers.

Share:
14,356
Sowmya
Author by

Sowmya

UI Developer with 6 years of experience.

Updated on June 04, 2022

Comments

  • Sowmya
    Sowmya almost 2 years

    I need background transparent only for black div. but it is applying even for buttons also which are in a tag.

    Here is my link http://jsfiddle.net/rCGJH/