Click to See Complete Forum and Search --> : [RESOLVED] CSS Opacity
dougal85
01-01-2007, 06:07 PM
filter:alpha(opacity=75);
-moz-opacity:0.75;
opacity: 0.75;
-khtml-opacity: 0.75;
This works fine in ff1.5, 2 and IE 7...
How do i set the transparancy of a div in IE6? Is it possible?
JPnyc
01-01-2007, 06:22 PM
You set it with the 1st command you have there. That is the correct syntax for IE6
dougal85
01-01-2007, 06:41 PM
Hmm, thanks. However its not working.
i stripped it right down to try and identify the problem without much luck. Am i overwriting it with the other conditions somehow? CSS hacks are my kryptonite
Below is the testing page i made, one div appears black and one gray in FF and ie7... but in ie6 both are solid black. so no transparency is working :(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">
#testdiv
{
width: 100%;
background-color: #000;
filter:alpha(opacity=50);
-moz-opacity:0.5;
opacity: 0.5;
-khtml-opacity: 0.5;
}
#testdiv2
{
width: 100%;
background-color: #000;
}
</style>
</head>
<body>
<div id="testdiv">
testing
</div><br />
<div id="testdiv2">
testing
</div>
</body>
</html>
bpat1434
01-01-2007, 09:46 PM
Perhaps this page will help: Opacity (http://www.mandarindesign.com/opacity.html)
Unfortunately I can't test with IE6 (upgraded to IE7....) so I can't really help you there. But it seems like it should work.
dougal85
01-01-2007, 11:31 PM
thanks... got it working from that website :)
bpat1434
01-02-2007, 12:16 AM
Would you mind telling us what it was?
dougal85
01-02-2007, 12:52 AM
Well, Firstly with that website i magaged to find out the version of internet explorer 6 i had (for some reason) wasnt even working with there method. so then i started testing with my old computer.
There website worked, so i coped there example, wich turned out to be the same as mine and i just removed '-khtml-opacity: 0.5;'
I've upgraded my IE to version 7 too, but ive got a standalone version of ie6 - its generally very good for testing css but this is helping remind me i cant rely on it.
to be honest, ive no idea what the line '-khtml-opacity: 0.5;' does or what browser its meant to be for? I got it from another example online... one that ive lost the link to.
JPnyc
01-02-2007, 02:32 AM
Something that might help, if you're using IE6 on win2k, if activeX is disabled, opacity (and other css commands) do not function. Don't ask me why, but they don't.
Weedpacket
01-02-2007, 04:54 AM
Because Microsoft implemented those things as ActiveX controls. I guess it was simpler than fixing the CSS engine directly.
Incidentally, the "-moz-opacity" rule isn't necessary either: Firefox (as well as Konqueror, for which the -khtml rule was provided) recognises the standard "opacity" rule.
JPnyc
01-02-2007, 10:58 AM
Correct, you don't need the moz or khtml special commands. They all understand the suggested standard of opacity syntax. All you need is that and the IE6 version, and you're in.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.