在 Android 版 Chrome 40 上,缩放固定宽度的页面以适应屏幕宽度很简单。一种使用 viewport
元标记并指定内容的宽度并禁用用户缩放:
在 Firefox OS 2.2 模拟器中,相同的代码不工作:
如何在 Firefox OS 浏览器中使固定宽度的内容适应屏幕宽度?
代码:
index.html
:<!doctype html> <title>Viewport test</title> <link rel="stylesheet" href="index.css" /> <meta name="viewport" content="width=1000,user-scalable=0" /> Test
index.css
:* { margin: 0; padding: 0; } body { font-size: 50px; width: 990px; border: 5px solid lightblue; }
最佳答案
我使用了以下元标记并且它有效:<meta name="viewport" content="width=device-width, user-scalable=no">
关于css - 将固定大小的页面缩放到屏幕宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28820117/