将固定大小的页面缩放到屏幕宽度?

时间:2015-03-02 21:50:33

标签: css html5 viewport fluid-layout firefox-os

在适用于Android的Chrome 40上,缩放固定宽度的页面以适应屏幕的宽度很简单。一个使用viewport元标记并指定内容的宽度并禁用用户缩放:

Screenshot showing content scaled to width in Chrome 40 for Android

在Firefox OS 2.2模拟器中,相同的代码工作:

Screenshot showing content scaled to width in

如何在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;
    }
    

1 个答案:

答案 0 :(得分:0)

我使用以下元标记,它可以正常运行:<meta name="viewport" content="width=device-width, user-scalable=no">