Loading lesson path
Concept visual
Start at both ends
Formula
Pseudo - elements for content allow you to insert content before or after elements, style list markers, and more.Formula
::before pseudo - element is used to insert some content before the content of a specified element.Use the content property to specify the content to insert.
Formula
Insert an image before the content of each < h3 > element:h3::before
{
content: url(smiley.gif);
}Formula
::after pseudo - element is used to insert some content after the content of a specified element.Use the content property to specify the content to insert.
Formula
Insert an image after the content of each < h3 > element:h3::after
{
content: url(smiley.gif);
}Formula
::marker pseudo - element is used to style the list item markers.Style the markers of list items:
::marker {
color: red;
font-size: 23px;
}Formula
::selection pseudo - element is used to style the part of a text that is selected by a user.Formula
Style the user - selected text with a red color, and a yellow background:::selection {
color: red;
background: yellow;
}Formula
::backdrop pseudo - element is used to style the viewbox behind a dialog box or popover element.Style the viewbox behind a dialog box:
dialog::backdrop {
background-color: lightgreen;
}Formula
For a complete list of all CSS Pseudo - elements, visit our
CSS Pseudo - elements Reference.