What are the functions of the pseudo elements '::after' and '::before'?

王林
Release: 2020-07-11 17:17:36
forward
4086 people have browsed it

What are the functions of the pseudo elements '::after' and '::before'?

:before and :after are two new pseudo-elements that appeared in CSS2.1.

(Recommended tutorial: css Quick Start)

At first, the prefix of pseudo-elements used single colon syntax, but with the evolution of the Web, in the CSS3 specification Here, a single colon represents a pseudo-class, and the syntax of a pseudo-element is modified to use a double colon, becoming ::before ::after. Pseudo elements do not exist in the dom, only in the page.

Function:

::after is used to create a pseudo element as the last child element of the selected element. Usually, the content attribute is used to add decorative content to the element. This virtual element is an inline element by default.

::before Creates a pseudo-element that will be the first child of the matching selected element.

The above is the detailed content of What are the functions of the pseudo elements '::after' and '::before'?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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 admin@php.cn
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!