CSS ::before (:before) Selector
Example
a::before {
content: "☞ "
}
Meaning
The ::before (:before) selector sets a style to be used immediately before the element.
Note: :beforechanged to ::before under CSS3 to make pseudo-elements obvious.
It is often used to add cosmetic content to an element with the content property. It is inline by default.
Version: CSS2
Standard Syntax
::before (:before) {
css declarations;
}
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
More Example:
The following example add quotation marks using ::before pseudo-elements is to provide quotation marks. Here we use both ::before and ::after to insert quotation characters:
Example
q::after {
content: "»";
color: red;
}
q::before {
content: "«";
color: blue;
}