Skip to content Skip to sidebar Skip to footer

Css Opacity Property

Hi i am using CSS Opacity Property for a div tag and it works well but the problem is when I write some text or paste images on that div tag they also become fade. I just need div

Solution 1:

It's much easier to use rgba() or a transparent PNG for the background.

rgba(0, 0, 0, .1);
rgba(0, 0, 0); //fallback

Solution 2:

You can use rgba() property for this:

write like this:

#fadediv
{
background-color: rgba(0,0,0,0.1);
width:750px;
height:150px;
background-color:#FFFFFF;
}

For IE you can use IE filter

background: transparent;-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000,endColorstr=#19000000)"; /* IE8 */filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000,endColorstr=#19000000);   /* IE6 & 7 */      zoom: 1;

You can generate your filter from here http://kimili.com/journal/rgba-hsla-css-generator-for-internet-explorer/

Solution 3:

Just use 1px semi transparent gif and repeat it by x and y. As far as I know it is the most easy way to set semi transparent background.

Solution 4:

Ofcourse the opacity applies to the child elements as well.What you can do is to segragate your markup.

<div id='Div-With-Opacity-set'>
</div>
<div id='Child-Elements-for-the-above-div'>
</div>

Align your markup carefully such that the markup resembles what you want.

Solution 5:

Why don't you reset the opacity then?

#text in fade div
{
    font-weight:bold;
    color:#8A2BE2;
    opacity:1;
    filter:alpha(opacity=100); /* For IE8 and earlier */
}

Post a Comment for "Css Opacity Property"