Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

::before 和 :after 中双冒号和单冒号有什么区别? #15

Open
ScoutYin opened this issue Jan 9, 2019 · 0 comments
Open

::before 和 :after 中双冒号和单冒号有什么区别? #15

ScoutYin opened this issue Jan 9, 2019 · 0 comments

Comments

@ScoutYin
Copy link
Owner

ScoutYin commented Jan 9, 2019

类似:link, :hover等,单冒号是用来表示伪类的,伪元素在CSS1中已存在,当时语法是用 : 表示,如 :before 和 :after,但是CSS3做了修订,伪元素用 :: 表示,如 ::before 和 ::after,以此区分伪元素和伪类;由于低版本IE对双冒号不兼容,开发者为了兼容性各浏览器,继续使使用 :after 这种老语法表示伪元素;综上所述:::before 是 CSS3 中写伪元素的新语法; :after 是 CSS1 中存在的、兼容IE的老语法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant