Little Web Hut
(Cascading Style Sheets) CSS 2.1 Reference

CSS Pseudo-element :before Selector

 

What is a CSS Pseudo-element :before Selector?

  • The :before pseudo-element selector allows content to be generated before the specified element. The content property is used to specify the content which will be generated. In the following example, an image will be displayed before the start of each <p> element.
CSS Example:
  p:before {content: url("../images/dots.gif");}
  <p>An image should be generated before this text.</p>
  <p>An image should be generated before this text.</p>
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style