transparent background issue IE8, IE7

淺唱寂寞╮ 提交于 2019-12-23 19:22:56

问题


use an icon (.png transparent background) for my menu. There isn't any problem for IE9, Chrome,Firefox,safari,opera.But if I open page with IE7 or IE8 there is a broken black border around image. CSS codes;

.menu-item1{
  background:url(img/spriteimage.png) no-repeat 0 0;
  height:20px;
  width:20px;
  opacity:0.5;
 } 

How can I fix this?


回答1:


IE7 and IE8 have native PNG support for alpha-transparencies, but it falls to pieces as soon as opacity comes into the picture

Try faking a background image or setting it to a blank.gif instead of making it transparent.

 background:url(blank.gif);

OR

 /* IE 8 */
 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";

  /* IE 7 */
  filter: alpha(opacity=50);


来源:https://stackoverflow.com/questions/13933713/transparent-background-issue-ie8-ie7

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