【发布时间】: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