How to make CSS opacity setting work in IE7 ?

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jul 2006
Posts: 174
Reputation: tefflox is an unknown quantity at this point 
Solved Threads: 1
tefflox's Avatar
tefflox tefflox is offline Offline
Junior Poster

How to make CSS opacity setting work in IE7 ?

 
0
  #1
Nov 30th, 2006
I have implemented a feature that works in firefox and opera, but doesn't work in IE -- it is the css opacity setting. I am overlaying translucent divs over a jpg image. Do I need to use javascript to fix this for IE ?

http://listenlight.net/05 is the page I'm working on.

Thanks. :-)
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How to make CSS opacity setting work in IE7 ?

 
0
  #2
Dec 1st, 2006
javascript won't do it i'm afraid, i've never tried an opacity setting in CSS, but if it's not in the official "standard" for CSS (and possibly even if it is) IE probably doesn't implement it.

you could try with medium alpha PNG files? that way, your image files contain the translucency (alpha) information in the pallete (or in each pixel). they could work in modern versions of IE...

if that doesn't work for you (I've never actually tried PNG translucency in browsers), you could always try good old fashioned screendoor transparency? XD
by that method, transparency is just "removing" pixels, the more pixels you remove, the more transparent a picture is ^_-

EDIT: Just a quick follow-up, translucent PNG files DO work (in Opera atleast).. To make a DIV background color transparent, use a small translucent PNG as the (tiled) background image. =)

EDIT (2): And just to follow that up again, translucent PNG's do NOT work in IE (version 6 atleast), maybe they work in IE7, I don't know. It might end up an IE-only screendoor job ^_-
Last edited by MattEvans; Dec 1st, 2006 at 2:00 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How to make CSS opacity setting work in IE7 ?

 
0
  #3
Dec 1st, 2006
And here's an EG,

http://www.fusiongroups.net/testbed/test.html

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <div>
  2. VERY OPAQUE<br/>
  3. <div style="position:absolute;width:400px;height:200px;background-image:url('bg1.gif');"><br/>This text is infront of (on) the screen-door
  4. <br/><br/>
  5. This is the tile used as the divs background-image:
  6. <br/>
  7. <img style="width:80px;height:80px;background-color:white;" src="bg1.gif"/>
  8. </div>
  9. This text is behind the screen-door!
  10. </div>

It looks ok at high (large) resolutions, at smaller resolutions it's clear that the image is dotted... On my somewhat blurry high-res screen though, you couldn't tell the difference between that and a translucent PNG ^_-
Last edited by MattEvans; Dec 1st, 2006 at 2:18 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 232
Reputation: Rhyan is an unknown quantity at this point 
Solved Threads: 24
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Posting Whiz in Training

Re: How to make CSS opacity setting work in IE7 ?

 
0
  #4
Dec 11th, 2006
There is a complete article about opacity here:

http://www.quirksmode.org/css/opacity.html

In general, I have quickly browsed through the text and I think you will need the following
Explorer Windows

Explorer Windows requires:
filter: alpha(opacity=50);
Note that an element must have layout for a filter to work.



For further clarification you should go through the complete article.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 2
Reputation: Alt_F4 is an unknown quantity at this point 
Solved Threads: 0
Alt_F4 Alt_F4 is offline Offline
Newbie Poster

Re: How to make CSS opacity setting work in IE7 ?

 
0
  #5
Nov 13th, 2008
I believe that if you set the width and height of the element as well, IE7 will in fact render the opacity correctly
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 167
Reputation: Drew is an unknown quantity at this point 
Solved Threads: 7
Drew's Avatar
Drew Drew is offline Offline
Junior Poster

Re: How to make CSS opacity setting work in IE7 ?

 
0
  #6
Nov 19th, 2008
Most versions of IE do support Opacity but never correctly implemented it so it requires a few work arounds to work fully.

  1. .myImage {
  2. filter: Alpha(Opacity=80); //IE
  3. opacity: 0.8;//other browsers that actually use standards
  4. }
Last edited by Drew; Nov 19th, 2008 at 7:42 pm. Reason: added non-ie css
Drew Gauderman
ASP / MSSQL Coder
http://www.iportalx.net - My ASP Portal
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC