Question

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.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top