我有一个包含 html 文件的 xcode 元素。我正在使用 iframe 嵌入一个 google doc,但是当我运行模拟器时,对于 iphone 6 和更大的手机,宽度在右侧溢出。它在 iphone 5 上看起来不错。
我尝试更改 google 文档中的边距并尝试对 iframe 进行一些样式设置。
iframe {
width: 100%;
display: block;
}
<iframe src="thesrc"></iframe>
我也尝试过将它嵌入到一个容器中,但这也没有用。我不确定这是 css 问题还是我无法在 xcode 中获得响应式 iframe。同样,似乎在 iphone 5 上运行良好。
最佳答案
如果我没有正确理解您的问题,我认为您需要提供正确的媒体 CSS 规则。我不知道你是否可以在 iframe 的外部 html 中这样做。
要执行媒体查询,您可以这样做
@media screen and (min-width:500px) {
body {
margin: 0 auto;
width: 768px;
}
}
关于ios - 当我嵌入谷歌文档时,xcode 中的 iframe 宽度溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46023931/