【问题标题】:CSS Content property not working in IECSS Content 属性在 IE 中不起作用
【发布时间】:2020-02-13 21:13:43
【问题描述】:

我目前正在一个网站上工作,我正在尝试以这种方式使用 CSS :before 伪类和 + 选择器在我的导航栏中创建链接分隔符:

/* Targets list items with a list item before it, so that we don't put separators before the first element, nor after the last element. */

nav li + li:before{content:url('someimagehere.gif');}

如果我不使用图像,并且使用诸如“/”之类的字符串,它在 IE(以及 Chrome、Firefox 等)中可以正常工作。但是,它是使用单独在 IE 中失败的图像(Chrome 和 Firefox 工作正常)。有想法该怎么解决这个吗?任何帮助表示赞赏!

更新:我刚刚发现上述规则在 IE 中被覆盖,但仅在 IE 中。所有其他浏览器似乎都可以很好地呈现它,而 IE 拒绝这样做,即使有 !important 声明。

【问题讨论】:

  • ie9 还是 ie10?你的浏览器是什么
  • 我正在 IE9 中进行测试,我正在使用开发工具查看它在 IE8 和 IE7 中的渲染效果。

标签: html css internet-explorer


【解决方案1】:

尝试将此添加到您的 html 页面的顶部。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

参考:

https://dl.dropboxusercontent.com/u/3525200/ie-content.png

http://www.w3schools.com/cssref/pr_gen_content.asp

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-25
    • 2015-11-21
    相关资源
    最近更新 更多