iframe 苹果 iphone meta width=device-width
在开发手机页面时,我们都会在头部添加一句话:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
但是我偶然使用iframe调用其他页面时,在iPhone上貌似不能识别上面一句话,安卓的没问题。
解决办法:
iframe { min-width: 100%; width: 100px; *width: 100%; }
在iframe上添加:(红色部分必加)
<iframe class="block" src="./pic.html" scrolling="no" frameborder="0" width="100%" onload="$(this).css({height:$($(this)[0].contentDocument).find('body').height()})"></iframe>
文章来源:http://stackoverflow.com/questions/20123960/how-to-get-iframe-width-100-in-iphone-portrait-view