The words get placed before the div, you can also use after in the script and not before.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<!DOCTYPE html> <html> <head> <style> .dog:before { content:"Read this - "; background-color:yellow; color:red; font-weight:bold; } </style> </head> <body> <div class="dog">My name is mike</div> <p>I live in Ducksburg</p> <b>Note:</b> For the content property to work in IE8, a DOCTYPE must be declared. </body> </html> |