<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html lang="en"> <head> <style> p:before { color: inherit; content: 'This text should be green.'; } </style> </head> <body style="color:red"> <p id="foo"></p> <script> document.getElementById('foo').style.color='green'; </script> </body> </html>