11

I'm working with css and I have tried to add an element 'before' to my div like an arrow. Is there any way to achieve it? I tried pseudo :before but there are three of them (::before(2), :before and ::before). They make me so confuse, what are differences in between?

Ringo
  • 3,795
  • 3
  • 22
  • 37
  • 1
    `::before` is the new implementation of the older `:before` -- it was to distinguish the difference between pseudo-elements (::) and pseudo-classes (:). Having said that, IE 8 only accepts `:before` and not the new syntax, while new browsers accept both, so it's better off using the old syntax if you want better compliance. I have **no** idea what `::before(2)` is, I've never seen it before. – Ming Dec 10 '13 at 02:45
  • It looks like `::before(2)` is for multiple `::before` pseudo-elements: http://www.w3.org/TR/css3-content/#inserting however, no major browser supports it yet: http://realworldvalidator.com/css/pseudoelements/::before(2) so don't use it. – Ming Dec 10 '13 at 02:50
  • Does this answer your question? [Can I have multiple :before pseudo-elements for the same element?](https://stackoverflow.com/questions/11998593/can-i-have-multiple-before-pseudo-elements-for-the-same-element) – Toastrackenigma May 15 '20 at 02:08

1 Answers1

23

The CSS spec on content describes all three syntaxes.

James Hill
  • 60,353
  • 20
  • 145
  • 161
Explosion Pills
  • 188,624
  • 52
  • 326
  • 405