2013-04-15 277 views
0

我想将iframe字体大小更改为150%。我已经设置在CSS然后结果不会改变,这仍然是一样的小文本。为什么它不改变大小?为什么iframe字体大小根本没有改变?

这里我的CSS代码,

#frame{ 
font-size:150%; 
} 

.frame { 
z-index:2000; 
} 

,然后我的HTML代码,

<div class="frame"> 
    <iframe id ="frame" srcdoc="<p></p>" width="930"></iframe> 
</div> 

然后在IFRAME打印文本一个javascript代码,

document.getElementById("frame").srcdoc += transcript; 
+0

后,你必须使用iframe? – MeRuud

回答

2
function changeSize(){ 
    var frame = document.getElementById("frame"); 
    var content = (frame.contentDocument || frame.contentWindow); 
    content.body.style.fontSize = "150%"; 
} 

尝试调用此功能,您已经添加了文字到您的iFrame像这样

document.getElementById("frame").srcdoc += transcript; 
changeSize(); 
1

CSS父页面不会影响iframe中的任何内容。事实上,iframe几乎完全从它出现的页面上的代码中被装箱。

+0

那我该怎么修? – StudentIT

+0

@StudentIT无法解决您的问题,如果您使用iframe,则无法执行此操作...使用iframe时存在很多限制。这是其中之一 – Zo72

相关问题