Pseudo-Elements
suggest changePseudo-elements are added to selectors but instead of describing a special state, they allow you to style certain parts of a document.
::before and ::after are not generated unless content is set. The value may be empty (content: ""). Other pseudo-elements, such as ::first-line and ::marker, do not use content the same way. content is a property, not an HTML attribute.
div::after {
content: 'after';
color: red;
border: 1px solid red;
}
div {
color: black;
border: 1px solid black;
padding: 1px;
}
div::before {
content: 'before';
color: green;
border: 1px solid green;
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents