3

I find I use the p:after and p::after I can get the same effect.(line 5 you can find it)

p:after {
  content: "- add_after";
  background-color: #f00;
}
<p>I am a boy。</p>
<p>I live in Duckburg。</p>

<p>this is my home</p>

So, whats the difference between the :after and ::after.

athi
  • 1,683
  • 15
  • 26
three-blocks
  • 353
  • 1
  • 4
  • 20

2 Answers2

2

Resource :https://css-tricks.com/almanac/selectors/a/after-and-before/

Every browser that supports the double colon (::) CSS3 syntax also supports just the (:) syntax, but IE 8 only supports the single-colon, so for now, it's recommended to just use the single-colon for best browser support.

:: is the newer format indented to distinguish pseudo content from pseudo selectors. If you don't need IE 8 support, feel free to use the double-colon.

Ehsan
  • 12,655
  • 3
  • 25
  • 44
0

This seperate pseudo elements from pseudo classes.

You can read the further detail about difference between pseudo classes and pseudo elements at

http://www.d.umn.edu/~lcarlson/csswork/selectors/pseudo_dif.html

Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68