ios - 为什么一个普通的网页在 iOS 上会被放大?

标签 ios css responsive-design mobile-safari

为什么 this jsfiddle page在 iOS 6.1 上的 Mobile Safari 上查看时出现到目前为止缩小了吗?我希望它占据整个宽度,但它却缩小了。我有如下非常无聊的 CSS,但我遗漏了一些东西。

.foo {
    overflow: auto;
    overflow-y: hidden;
    height: 100px;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}
.foo ul li {
    display: inline-block;
    border: 1px blue solid;
    max-width: 100px;
    overflow: auto;
    white-space: normal;
}

最佳答案

添加

<meta name="viewport" content="initial-scale=1.0,width=device-width" />

<head>里面

Working example (standalone)

Working example (jsfiddle)

背景:默认情况下,移动版 Safari 显示 Canvas 宽度为 980px 的页面(参见 this answer ),“宽度”参数会覆盖此值,“设备宽度”会自动将其设置为任意大小(或纵向/横向) ) 你正在使用。它最初由 Apple 推出,但 pretty much everything now supports it .

为了在 jsFiddle 中工作,您需要将元标记添加到 CSS Pane ,但将其包装在 </style> 中。/<style type="text/css">标签,所以它出现在头部。此外,普通的嵌入共享链接将不起作用,因为所有内容都包含在 iframe 中,因此您需要直接拆分其中的内容:.../show/light/

(如果您有 Mac,iOS 模拟器对于此类事情很方便 - 需要安装 XCode。还有 Chrome 开发工具 > 设置(齿轮图标,右下角)> 覆盖 > 设备指标)

关于ios - 为什么一个普通的网页在 iOS 上会被放大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17713754/

相关文章:

ios - CAKeyframe动画缩放

ios - 如何在swift 4中将导航动画从左到右更改?

css - 针对相同的 :after pseudo element with 2 classes on the same element

html - 使用 css 媒体查询(无 Bootstrap )使第三个内联 block div 高于前两个

html - 在 Twitter Bootstrap 3.1 中重新排序 div 未按预期工作

html - 将背景扩展到 100% 的 bootstrap 3 .row

ios - popToViewRootController swift

ios - 创建具有无限垂直滚动单元格的 UICollectionView

css - 基本的 CSS 让我头晕目眩

android - 在调整大小时调整 ionic 菜单的大小