Apply css to an iframe - Javascript jQuery

Javascript examples for jQuery:iframe

Description

Apply css to an iframe

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://code.jquery.com/jquery-1.6.3.min.js"></script> 
      <script>
        $(document).ready(function() {
            $('#iframe').load(function() {
                $("#iframe").contents().find("head").append("<style>.text_color{color:red;}@page{margin:0;}</style>");
            });/*from ww w.  j  av a2s.c o m*/
        });
        
      </script> 
   </head> 
   <body> 
      <iframe src="http://java2s.com" id="iframe" name="iframe"></iframe>  
   </body>
</html>

Related Tutorials