html gif具有透明背景,但在img标签和css background属性中变为白色

时间:2019-07-09 12:10:19

标签: html css gif

我有一个透明背景的gif图像,如您在我的桌面上所见:

enter image description here

但是当我在html代码中使用它时,会变成白色背景。 我已经测试了背景css属性和stackoverflow以及Google主页其他站点中的答复。 这是我的代码:

<img src="/content/elecomp98/pahbad.gif" style="position: absolute;top: 50px;left: 0;width: 250px;">

<div style="width: 250px;height: 280px;background: url(/content/elecomp98/pahbad.gif);position: absolute;left: 0;top: 50px;background-size: cover;display: none;"></div>

enter image description here

1 个答案:

答案 0 :(得分:2)

请注意,“ {Pahbad.gif”与“ pahbad.gif”不同。

图片网址区分大小写

  

级联样式表(CSS)不区分大小写。但是,字体家族,图像的URL以及样式表中的其他直接引用可能是

我建议您链接错误的图片。