Apply CSS to <invalid> elements - Javascript DOM

Javascript examples for DOM:Document createElement

Description

Apply CSS to <invalid> elements

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

invalid {//from   w ww.jav a  2  s  .  co  m
   color: red;
}


      </style> 
      <script type="text/javascript">
document.createElement('invalid');

      </script> 
   </head> 
   <body> 
      <invalid>
         and they said I couldn't be red
      </invalid>  
   </body>
</html>

Related Tutorials