html - How to apply CSS to iframe? -


i have simple page has iframe sections (to display rss links). how can apply same css format main page page displayed in iframe?

edit: not work cross domain unless appropriate cors header set.

there 2 different things here: style of iframe block , style of page embedded in iframe. can set style of iframe block usual way:

<iframe name='iframe1' id="iframe1" src="empty.htm"          frameborder="0" border="0" cellspacing="0"         style="border-style: none;width: 100%; height: 120px;"></iframe> 

the style of page embedded in iframe must either set including in child page:

<link type="text/css" rel="stylesheet" href="style/simple.css" /> 

or can loaded parent page javascript:

var csslink = document.createelement("link"); csslink.href = "style.css";  csslink.rel = "stylesheet";  csslink.type = "text/css";  frames['frame1'].document.body.appendchild(csslink); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -