Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css pseudo-element ::before(2); :before and ::before

Tags:

css

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?

like image 226
Ringo Avatar asked Dec 10 '13 02:12

Ringo


1 Answers

The CSS spec on content describes all three syntaxes.

  • :before -- outdated syntax for pseudo elements. Use if older browser support is needed such as IE8. IE9 supports the new syntax. It also seems like iOS Safari does not support the new syntax
  • ::before -- new pseudo element syntax. This is equivalent to ::before(1)
  • ::before(n) -- used to create multiple before elements that can be before other ::befores. Details are in the same spec.
  • As far as I can tell, no browser supports this.
    • http://jsfiddle.net/535Rf/
like image 72
Explosion Pills Avatar answered Oct 09 '22 20:10

Explosion Pills