Insert Content Before an Element with CSS



Use the :before element to insert some content before any element. 

Example

You can try to run the following code to insert some content before an element with CSS −

Live Demo

<html>
   <head>
      <style>
         p:before {
            content: url(/https/www.tutorialspoint.com/images/bullet.gif)
         }
      </style>
   </head>
   <body>
      <p> This line will be preceded by a bullet.</p>
      <p> This line will be preceded by a bullet.</p>
      <p> This line will be preceded by a bullet.</p>
   </body>
</html>
Updated on: 2020-03-13T13:04:46+05:30

104 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements