Home >Web Front-end >Front-end Q&A >What do double colons represent in css3 attributes?
The double colon in the css3 attribute indicates that the attribute is a pseudo-element selector, which is a selector used to create some elements that are not in the DOM tree and add styles to them. CSS3 pseudo-elements include "::after", "::before", "::first-letter", "::first-line" and so on.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
The double colon in the css3 attribute indicates that the attribute is a pseudo-element selector.
What is a pseudo element?
Pseudo elements are literally understood as "fake elements" or "disguised elements". In fact, it can be understood this way. Pseudo elements are actually virtual elements. Elements that do not exist (in code form), and you cannot find them in the document, so pseudo elements are virtual elements.
Pseudo element is a selector used to create some elements that are not in the DOM tree and add styles to them.
With pseudo-elements you can define styles for specific parts of the selected element without resorting to the element's ID or class attributes. For example, through pseudo-elements you can set the style of the first letter in a paragraph, or insert some content before or after the element, etc.
CSS provides a series of pseudo-elements, as shown in the following table:
Pseudo-elements | Example | Example description |
---|---|---|
::after | p::after | Insert after each element Content |
::before | p::before | Insert content |
p::first-letter | Matches the first letter of the content in each | |
p::first-line | Matches the first line of content in each | |
p::selection | Match the part of the element selected by the user | |
input:: placeholder | Match the placeholder attribute of each form input box (such as ) |
css video tutorial、web front end)
The above is the detailed content of What do double colons represent in css3 attributes?. For more information, please follow other related articles on the PHP Chinese website!