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
Post a Comment