I need opacity (transparency) for a img with css ie8

故事扮演 提交于 2019-12-23 05:12:50

问题


I added the attribute opacity: .3; to my img tag but it only works for firefox. Is there a solution for firefox and ie8?


回答1:


<img src="yourimage.jpg" alt="Text" class="opac" />

<style>
.opac
{
    opacity:0.3; filter:alpha(opacity=30); height: 150px; width: 150px;
}
</style>



回答2:


If you're using ie8 in standards mode you need to use:

-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";



回答3:


IE uses the filter property:

filter: alpha(opacity = 30); /* Supported by IE7 and 8 */

That should do the same as opacity: 0.3



来源:https://stackoverflow.com/questions/1426846/i-need-opacity-transparency-for-a-img-with-css-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!