The ::before pseudo-element in CSS allows you to insert content before the content of a selected element. It is commonly used to add decorative elements or additional content without modifying the HTML structure.
Here's the basic syntax:
selector::before {
/* CSS properties */
}
You can use the content property to specify what to insert. For example, to add a decorative icon before a paragraph:
p::before {
content: "★"; /* Adds a star before the paragraph */
color: gold; /* Sets the color of the star */
}
This will display a star before the text of every <p> element on the page.
