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.
精彩评论