How can I combine a pseudo-element selector (:after
) with an attribute selector ([title]
)?
I tried using div[title]:after
, but
This looks like a bug, which has finally been reported. If you add a CSS rule for div[title]
anywhere in your stylesheet with at least one declaration, your div[title]:after
rule will magically apply. For example:
div:after {
content: "NO";
}
div[title] {
display: block;
}
div[title]:after {
content: "YES";
}
See the updated fiddle.
It also seems to have something to do with your second div
having or not having certain HTML attributes, as shown in the comments below.