Back

建立3G/h5/wap网页其实很简单( quite easy to write mobile web page)

发布时间: 2014-10-19 08:26:00

只需要把下列代码加到页面中就好:

<!DOCTYPE html>
<html>
  <head>
    <title>注册</title>
    <meta charset="utf-8" />
    <meta name="apple-mobile-web-app-title" content="">
    <link rel="apple-touch-icon" href="http://2008mail.sina.com.cn/images/mobile/icon_touch.png">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0, user-scalable=yes"/>
    <style type="text/css">
      /** your css **/
    </style>
  </head>
  <body>
  </body>
</html>

否则页面的文字大小会特别难看。

注意: 在开发过程中,不要增加下面这行,否则会无法开发(scroll bar missing) : 参考:http://www.dreamincode.net/forums/topic/331528-scroll-bar-missing-when-open-on-mobile-browser/

<style type="text/css">html,body{min-height:100%;overflow:hidden;}</style>

有时候我们希望在移动端可以控制缩放等,可以这样:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0, user-scalable=yes"/>

Back