HTML CSS examples for CSS Selector:before
The ::before selector selects content before the content of each selected element.
To set the content use the content property.
You can use the ::after selector to insert content after the original content inside an element.
Insert content before every <p> element's content
<!DOCTYPE html> <html> <head> <style> p::before {<!--from ww w.j a v a2 s . c o m--> content: "news:"; background-color: red; color: red; font-weight: bold; } </style> </head> <body> <p>this is a test</p> <p>this is another test</p> </body> </html>