IE 8: background-size fix with -ms-filter

2019-09-07 06:33发布

问题:

I found the same problem on Stackoverflow and a fix was posted: https://stackoverflow.com/a/9169401/1107123

I can make it work, but as soon I'm using it with PHP it does not.

Any ideas?

I also looked at this: https://stackoverflow.com/a/10147089/1107123 But I have no idea how to implement it. The documentation is very vague :/

This does not work: (Inside PHP)

echo "<div style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img.gif',sizingMethod='scale'); -ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img.gif',sizingMethod="scale');'></div>";

This works just fine: (HTML)

<div style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img.gif',sizingMethod='scale'); -ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="img.gif",sizingMethod="scale");"></div>

Original Code:

echo        "<div class='sponsorImage' style='background-image:url($row[piclink]);'></div>";

How do I use the -ms-filter with this?

回答1:

It's not concern of PHP/RubyRails or whatever- it all about css compatibility with browsers - Try out this one http://pastebin.com/RZ0krHj0,