How can I combine a pseudo-element selector (:after
) with an attribute selector ([title]
)?
I tried using div[title]:after
, but this doesn't work in Chrome.
HTML:
<div title="foo">This div has a title.</div>
<div>This div does not have a title.</div>
CSS:
div:after {
content: "NO";
}
div[title]:after {
content: "YES";
}
Demo: http://jsfiddle.net/jmAX6/
It shows me "YES" at the end of each of those div's, when it should show "NO" after the second div.
I'm running Chrome 17.0.963.38. It seems to work fine in Safari 5.1.2.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…