Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <style> span { color: blue; border: 1px solid black; } .extra span { color: inherit; } </style> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <div> Here is <span>a span element</span> which is blue, as span elements are set to be. </div> <div class="extra" style="color:green"> Here is <span>a span element</span> which is green, because it inherits from its parent. </div> <div style="color:red"> Here is <span>a span element</span> which is blue, as span elements are set to be. </div> </body> </html>
Result: