【问题标题】:Adjacent sibling selectors and :before pseudo element in Chrome 10Chrome 10 中的相邻兄弟选择器和 :before 伪元素
【发布时间】:2011-08-05 17:38:29
【问题描述】:

这是一个奇怪的问题。 http://www.madebypaz.com/profile 上的 <OL> 使用 :before 伪元素作为图表的注释(ABC 和图像)。我像这样使用相邻的兄弟选择器:

#profiletext ol li:before {
    content: 'A';
    }

#profiletext ol li+li:before {
    content: 'B';
    }

#profiletext ol li+li+li:before {
    content: 'C';
    }

#profiletext ol li+li+li+li:before {
    content: '';
    }

#profiletext ol li+li+li+li {
    background: url('/wp-content/themes/paz2010/images/sweet-spot.png') no-repeat;
    margin-left: 0;
    padding-left: 38px;
    }

#profiletext ol li {
    height: 30px;
    margin-left: 10px;
    }

这可能不是最优雅的解决方案,但它在包括 Chrome 在内的所有浏览器中都能完美运行,直到有人向我指出它在 Chrome 10 中出现故障。在 Chrome 10 中,它显示 AAA 并在鼠标悬停时更改为正确的字符.这很奇怪,因为甚至没有定义 :hover 样式!

这是一个屏幕记录:http://cl.ly/0E170v1Z0O2E0f3F0j0d

为什么会发生这种情况,我该如何解决?有没有更好的方法来达到同样的效果?

任何指针都非常感谢!

【问题讨论】:

  • 我也遇到过类似的问题;也只有 chrome,但随后作为 ~:before 选择器之间的交互。

标签: css google-chrome css-selectors pseudo-element


【解决方案1】:

这在 Chrome 16 上可以正常工作 - 需要进行简单的更新。

【讨论】:

  • 糟糕,您似乎已经制定了解决方法,而不是上面引用的代码。
猜你喜欢
  • 2012-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-13
  • 1970-01-01
  • 2011-10-30
  • 2017-06-07
相关资源
最近更新 更多