【问题标题】:IE10 and after pseudoelementsIE10 及之后的伪元素
【发布时间】:2017-03-31 15:05:23
【问题描述】:

我正在使用 after 伪元素在 h3 悬停上进行非常简单的转换。我读过 ::after 在 IE10 上工作(它在渲染它时工作),但不是悬停。

h3 {
  position:relative;
}
h3::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -5px;
  width: 10px;
  height: 2px;
  background: blue;
  left: 0;
  -ms-transition: all .5s;
  transition: all .5s;
}
h3:hover::after {
  width: 100%;
}
h3 a {
  text-decoration: none;
  position: relative;
  display: inline-block;
}
<!DOCTYPE html>
<h3>
<a href='#'>Hello</a>
</h3>

其他浏览器也有魅力,我不知道IE10会发生什么...

【问题讨论】:

  • ie10 仿真对我有用。
  • @Huelfe 它对你有用吗?我在 IE10 中尝试了完全相同的代码,但不起作用。我不知道为什么,但是如果我尝试使用 &lt;a&gt; 而不是 &lt;h3&gt; 它会起作用。

标签: html css hover internet-explorer-10


【解决方案1】:

尝试为 h3 添加空的悬停选择器。 h3:悬停{}

【讨论】:

  • 看起来有效。在 JSFiddle 中,它可以正常工作,但由于我无法理解的原因,我的项目中相同的确切代码,它没有。
  • 好的,这与项目在我们得到它之前的一些 javascript 相关,以及一些用于 IE 的“如果”,但你提供的东西也很有效,谢谢!
猜你喜欢
  • 2012-12-16
  • 2016-08-14
  • 2013-07-06
  • 2013-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-26
相关资源
最近更新 更多