How to set the width of an iframe in iOS6?

折月煮酒 提交于 2019-12-04 05:38:06

Although width is ignored, min-width isn't. So something like this has the same effect as width:100%:

iframe {
  width: 1px;
  min-width: 100%;
}

The width parameter of the iframe is ignored in mobile Safari so the width must be set in px with CSS.

I fixed the problem by checking the user agent with JavaScript. If it's an iOS device, I set the width of the iframe in px with CSS to be the exact size as the container.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!