Use ::before selector to add text before the content of each <p> element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:before

Description

Use ::before selector to add text before the content of each <p> element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p::before {<!--from   w  w w.  java2 s . c  o  m-->
    content: "News:";
}
</style>
</head>
<body>

<p>this is a test</p>
<p>this is another test</p>

</body>
</html>

Related Tutorials