can be used to represent pseudo-class objects, used to set The content before the object
:before and ::before writing are equivalent
- ##:before is the writing method of Css2, ::before is the writing method of Css3
- :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
/* 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!