CSS :before Selector
ExampleHow to insert content before all <p> elements:
Try it yourself » |
Definition and Usage
The :before selector inserts content in front of the selected element(s).
Use the CSS content property to specify the content.
Read more about the content property in our content property reference.
Browser Support
The :before selector is supported in all major browsers.
Note: For :before to work in IE, a <!DOCTYPE> must be declared.
CSS Version
The :before selector was first introduced in:
CSS 2
Related Pages
CSS tutorial: CSS Pseudo-elements
CSS Selector Reference: CSS :after selector
Try it Yourself - Examples |
ExampleStyle the inserted content:
Try it yourself » |
Complete CSS Reference