开发者

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

开发者 https://www.devze.com 2023-01-30 17:23 出处:网络
How to, using JavaScript, resize an iframe, so its width will be equal to real value of 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

精彩评论

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