Two ::after pseudo-elements

JellicleCat picture JellicleCat · Jun 1, 2012 · Viewed 60k times · Source

I'd like to apply two css ::after pseudo-elements to a single DOM element, each with a different colour. (Yes, I could wrap the DOM element in another DOM element and give each one and ::after pseudo-element, but my preference is cleaner html.)

I doubt it's possible, but wonder if someone can tell me better.

I especially doubt the possibility of chaining ::after pseudo-elements together so that one ::after pertains to another, which pertains to a DOM element, but if anyone knows how to make that happen, please do tell.

Answer

Zoltan Toth picture Zoltan Toth · Jun 1, 2012

You can use a :before pseudo-element in addition to your :after - http://jsfiddle.net/BePSq/