Welcome visitor
* Login
* Register
It is currently March 21st, 2019, 11:50 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 4 posts ] 
Author Message
  Apply CSS to an Iframe
PostPosted: January 2nd, 2010, 11:55 pm 

Posts: 31
If I'm applying a CSS stylesheet to my website, is there a way to apply also to the content inside iframes?


Top
 Profile  
 
  Re: Apply CSS to an Iframe
PostPosted: January 3rd, 2010, 6:47 am 
User avatar

Posts: 137
Only if the iframes content belongs to the same domain. Add the <link> tag to all the framed documents :D


Top
 Profile  
 
  Re: Apply CSS to an Iframe
PostPosted: January 5th, 2010, 9:54 pm 

Posts: 31
Isn't there an automatic way to do it from the parent page?


Top
 Profile  
 
  Re: Apply CSS to an Iframe
PostPosted: January 7th, 2010, 5:46 pm 
User avatar

Posts: 52
I found this JavaScript method on the web
<body onload="xchange();">
<script type="text/javascript">
function xchange(){
  cssLink = document.createElement("link") 
    cssLink.href = "file.css";  //this should have the name of your CSS file
    cssLink.rel = "stylesheet"; 
    cssLink.type = "text/css"; 
var doc=document.getElementById("iframeID").contentWindow.document; 
doc.body.appendChild(cssLink);
}
</script>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron