开发者

JavaScript: Iframe's width attribute change based on the available space?

How to, using JavaScript, resize an iframe, so its width will be equal to real value of available space?

开发者_StackOverflowSetting width to 100% results in white borders around the meant iframe.


If you want your iframe to cover your entire site, and don't want to use a frameset page, try...

CSS

html,
body {
   height: 100%;  
}   

body {
   margin: 0;
   padding: 0;
     
}

iframe {
   width: 100%;
   height: 100%;   
   border: none;  
}

See it on jsFiddle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜