图片不会加载"content:url()";在Internet Explorer中 [英] Image won't load with "content: url()" in Internet Explorer

查看:714
本文介绍了图片不会加载"content:url()";在Internet Explorer中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个网站上工作,我的网站必须在Chrome和Internet Explorer 9中工作.我快要完成了,只剩下一个问题了.如果我想使用"content:url()"加载图像,则它可以在Chrome浏览器中完美运行,但不能在IE9中运行.有人可以给我另一种解决方案,在其中我不需要更改HTML的地方.

I'm working on a website and my website has to work in Chrome and in Internet Explorer 9. I'm almost finished and I have only one problem left. If i want to load an image with "content: url()" it works perfectly in Chrome but not in IE9. Can somebody please give me another solution where I where i don't have to change my HTML.

我的HTML:

<!DOCTYPE html>
 <html lang="nl">
 <head>
  <title>Test</title>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="test.css" />
 </head>
 <body>
  <header>
  </header>

  <a id="photo">Photo</a>

  <footer>
  </footer>
 </body>
</html>

我的CSS:

#photo {
 content: url('right-button.png');
}

推荐答案

尝试一下:

#photo {
    background: url("right-button.png") no-repeat;

}

有关更多信息,请阅读此处,我发现了一些有关content属性的文章:

For more informations read here some articles i found for content attribute:

内容属性 W3c

这篇关于图片不会加载"content:url()";在Internet Explorer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆