The similarities and differences between :before and ::before

零下一度
Release: 2017-06-24 11:28:07
Original
1675 people have browsed it
  • Same points

    1. can be used to represent pseudo-class objects, used to set The content before the object

    2. :before and ::before writing are equivalent

  • Differences

    1. ##:before is the writing method of Css2, ::before is the writing method of Css3

    2. :before has better compatibility than ::before, but it is recommended to use ::before in H5 development

Notes:

Pseudo-class objects should be used together with the content attribute

Pseudo-class objects will not appear in the DOM, so they cannot be operated through js. They are only added to the CSS rendering layer

Pseudo-class objects Special effects usually use the :hover pseudo-class style to activate



##.test:hover:: before {
/* This is when animation and transition take effect */ }

The above is the detailed content of The similarities and differences between :before and ::before. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!