Transparent DIV SPAN for all browsers, Firefox, Opera, Safari, Chrome, Internet Explorer
To make an HTML element transparent. Just use these css elements in your css class. filter, moz-opacity, opacity.
Internet Explorer uses filter and firefox uses moz-opacity.
.transparent { filter:alpha(opacity=60); -moz-opacity: 0.6; opacity: 0.6; }
<div class="transparent">A transparent div. </div>
The opacity value changes from 0 to 1.



excellent bit of info there it really helped to make transparent divs that work on both firefox and IE thankyou
Hi, good short tutorial. What is the solution when I need the text within the DIV to be 100% opaque over, let’s say, a 60% transparency DIV? As far as I could see testing, the text gets faded in the same scale as the div even if I put a 100% opaque tag inside the DIV. Thanks.
[...] Transparent DIV SPAN for all browsers | Can Erten – [...]
Wow, it works, excellent!
Do you mind if I share and translate this to another language on my blog?
Many thanks
[...] Terimakasih Can Erten! [...]
You are very welcome indeed.
Good stuff! Just what I was looking for. Works great!
What I do if I want to make a div with a transparent background but have text show up opaque is I make two divs with identical properties. Then, I take one div, put it behind the other, and make it transparent. Then, I put all of my content in the other div. Therefore, one div is used for content and is opaque; the other div is used for the background and is transparent. That’s just what I do. There may be a better way.
Que te vaya bien.
thanks, simple & easy, it’s works!
Great example. I’d only note that Firefox now simply supports “opacity”, so you don’t have to use “-moz-opacity” anymore.
Works, but IE6 blocks “filter:alpha(opacity=60);” and shows a yellow bar so you manually have to enable it to get the visual effect…
A tip to others: if you only want the bg transparent and not the contents, you better put a div just behind the div you are using where you apply a white semi-transparent background.
it’s just what i need
. thanx
Thanks man! that I needed!!! Thanks again!
Thank you for solving my IE problem.
Thanks!
thank u so much bro
Thank you!
Simple and it works. Thank you very much, it solved my problem completely.
Great…
Excellent, thats really a great post!!!
this opens horizons. thanks.
Excellent idea, Thanks a lot.
Hi,
Everyone seems to be having success getting this to work in IE. I’m using IE8 and it’s not working for me. Here is the css I am using for the transparent div:
#feedscroller {
display: block;
background: #fff;
overflow: scroll;
width: 598px;
height: 390px;
border: 1px solid #c6cdb4;
opacity: 0.5;
filter:alpha(opacity=50);
-moz-opacity: 0.5;
}
any ideas anyone?
Does anyone know what the performance difference is using this method over using a 1 pixel semi-transparent png?
Hey there,
Thanks so much! This worked perfectly- now my page works in IE, Firefox and Chrome
Cheers
Remember you have to have a width (‘auto’ won’t work) for this to work in IE7
Superb!
Cheers
Hey everyone. I love this. I have one more question: How do I get just the background to be transparent. Right now, EVERYTHING associated with the element is transparent.
#main {
background:#000000;
filter:alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
}
Content
The container is transparent, and so is the text and that is my problem. Any help would be great, thanks.
Apparently the only way is to move your content outside the transparent container (HTML-wise) and then use trickery to make it _visually_ appear on top of the transparent container when the page is rendered. (One suggested trick has something to do with negative margin values in CSS.)
thanks Coding Day !!! it works well in IE hell
and also thanks Shelly Caldwell ! for giving valuable tip about the width property.
#transparency {filter: alpha(opacity=55); -moz-opacity: .55; background-color:#EEE; position:absolute; top:450px; left:110px; }
Thank you so much for this code……..it’s working…..