CSS Selector :before

Description

The :before selector inserts content before the content of the selected elements.

Example


<!DOCTYPE html>
<html>
<head>
<style>
p:before{<!--  ww w .  j  a v a  2  s  .com-->
   content:"added before";
}
</style>
</head>

<body>
   <p>this is a paragraph.</p>

</body>
</html>

Click to view the demo

The code above generates the following result.

:before




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference