This is a bit tricky. For one thing, if you are using an external stylesheet, the path to the filter's image may have to be either absolute or relative to the page that is using it, rather than relative to the stylesheet. This is because MS filters are in reality javascript, not pure style. If the stylesheet is on the page or the stylesheet and the page both occupy the same relative position on your site, this is not a consideration.
Now, the real trick is to get IE to do it one way and all others to do it another way, here is one method for that:
Code:
#menubarB{
margin-top: -15px;
margin-left: 55px;
float: left;
width:465px;
height:66px;
}
body>#menubarB{
background: transparent url(assets/template_images/what-we-do_home.png) no-repeat;
}
* html #menubarB {
background-color: transparent;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='assets/template_images/what-we-do_home.png', sizingMethod='scale');
}
Notice the red body in the second selector. This must actually be the #menubarB's immediate parent element.
This method may have problems in IE 7 (if it supports the > selector). IE version specific conditional comments can be used if this is the case but, this means that the the IE part of the style must be in a separate stylesheet on the page itself, inside of a version specific conditional comment block.
It will have problems in earlier version of IE, those before 5.5 which do not support this filter. If that is a consideration, it can also be solved with version specific conditionals.
Bookmarks