Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> span { color: blue; border:1px solid black; } </style> </head> <body> <div>Here is <span>a span element</span> inside an element with no color property set. <div style="color:green"> Here is <span id="mySpan">a span element</span> inside an element with color:green. </div> <div style="color:red"> Here is <span>a span element</span> inside an element with color:red. </div> </div> <p>Click the "Try it" button to set the value of the color property to "inherit" for the second SPAN element:</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("mySpan").style.color = "inherit"; } </script> </body> <!-- Mirrored from www.w3schools.com/cssref/tryit.asp?filename=trycss_js_inherit by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:24:40 GMT --> </html>
Result:
Try it Yourself - © w3schools.com