part1
1、天猫(http://m.tmall.com)css
<title>天猫触屏版</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta content="telephone=no" name="format-detection">
2、淘宝(http://m.taobao.com)html
<title>淘宝网触屏版</title> <meta charset="utf-8"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-touch-fullscreen"> <meta content="telephone=no" name="format-detection"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta property="wb:webmaster" content="c51923015ca19eb1"> <meta name="author" content="m.taobao.com"> <meta name="copyright" content="Copyright ©m.taobao.com 版权全部"> <meta name="revisit-after" content="1 days"> <meta name="keywords" content=""> <meta name="description" content="">
3、京东(http://m.jd.com)前端
<title> 京东 - 手机版 </title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"> <meta name="format-detection" content="telephone=no"> <meta name="Keywords" content="手机购物,WAP商城,日用百货,3C家电,汽车用品"><meta name="description" content="京东手机版提供了包括数码、家电、手机、电脑配件、网络产品、日用百货等数万种商品,手机快捷购物,就上京东手机版。">
4、网易(http://3g.163.com)html5
<title>手机网易网</title> <meta charset="UTF-8"> <meta content="width=device-width,user-scalable=no" name="viewport"> <meta name="apple-itunes-app" content="app-id=425349261"> <meta name="apple-mobile-web-app-capable" content="yes">
5、百度(http://m.baidu.com)android
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> <meta name="format-detection" content="telephone=no">
meta指元素可提供有关页面的元信息(meta-information),好比针对搜索引擎和更新频度的描述和关键词。 标签位于文档的头部,不包含任何内容。 标签的属性定义了与文档相关联的名称/值对。
手机端特有的有哪些?ios
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta content="telephone=no" name="format-detection">
第一个meta标签表示:强制让文档的宽度与设备的宽度保持1:1,而且文档最大的宽度比例是1.0,且不容许用户点击屏幕放大浏览;css3
width - viewport的宽度 height - viewport的高度 initial-scale - 初始的缩放比例 minimum-scale - 容许用户缩放到的最小比例 maximum-scale - 容许用户缩放到的最大比例 user-scalable - 用户是否能够手动缩放
第二个meta标签是iphone设备中的safari私有meta标签,它表示:容许全屏模式浏览;
第三个meta标签也是iphone的私有标签,它指定的iphone中safari顶端的状态条的样式;web
在web app应用下状态条(屏幕顶部条)的颜色; 默认值为default(白色),能够定为black(黑色)和black-translucent(灰色半透明)。 注意:若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)。
第四个meta标签表示:告诉设备忽略将页面中的数字识别为电话号码。
参考:
一、百度百科meta
浏览器
二、手机网站前端设计服务器
四、手机端的一些标准
转自http://www.cnblogs.com/kuikui/p/3590673.html
part2
下面介绍一些有关标记的例子及解释。
一、http-equiv 属性的 Content-Type 值(显示字符集的设定)
说明:设定页面使用的字符集,用以说明主页制做所使用的文字语言,浏览器会根据此来调用相应的字符集显示 page 内容。
用法:
1
|
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
|
注意:该 meta 标签订义了 HTML 页面所使用的字符集为 utf-8 ,就是万国码。它能够在同一页面显示中文简体、繁体及其它语言(如日文,韩文)等。
二、name 属性的 viewport 值(移动屏幕的缩放)
也就是可视区域。对于桌面浏览器,咱们都很清楚 viewport 是什么,就是除去了全部工具栏、状态栏、滚动条等等以后用于看网页的区域,这是真正有效的区域。因为移动设备屏幕宽度不一样于传统 web,所以咱们须要改变 viewport 值。
实际上咱们能够操做的属性有 4 个:
width – // viewport 的宽度 (范围从 200 到 10,000,默认为 980 像素)
height – // viewport 的高度 (范围从 223 到 10,000 )
initial-scale – // 初始的缩放比例 (范围从 > 0 到 10)
minimum-scale – // 容许用户缩放到的最小比例
maximum-scale – // 容许用户缩放到的最大比例
user-scalable – // 用户是否能够手动缩放 (no,yes)
1
|
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
|
说明:
注意:实际测试中发现,有些安卓系统自带的浏览器并不支持这一条规则,可以对页面进行放大,一旦放大响应的 box 也随之放大,致使页面出现错乱问题,解决方法:定义页面的最小宽度
1
2
3
|
body {
min-width
:
320px
;
}
|
三、name 属性的 format-detection 值(忽略页面中的数字识别为电话号码)
1
|
<
meta
name
=
"format-detection"
content
=
"telephone=no"
/>
|
说明:
四、name 属性的 apple-mobile-web-app-capable 值(网站开启对 web app 程序的支持)
1
|
<
meta
name
=
"apple-mobile-web-app-capable"
content
=
"yes"
/>
|
说明:
五、name 属性的 apple-mobile-web-app-status-bar-style 值(改变顶部状态条的颜色)
1
|
<
meta
name
=
"apple-mobile-web-app-status-bar-style"
content
=
"black"
/>
|
说明:
注意:若值为“black-translucent”将会占据页面位置,浮在页面上方(会覆盖页面 20px 高度 iphone4 和 itouch4 的 Retina 屏幕为 40px )。
六、name 属性设置做者姓名及联系方式
1
|
<
meta
name
=
"author"
contect
=
"liudanyun, liudy102@163.com"
/>
|
固然,配合 Web App 的 icon 和启动界面须要额外的两端代码进行设定,以下所示:
1
|
<
link
rel
=
"apple-touch-icon-precomposed"
href
=
"iphone_logo.png"
/>
|
说明:这个 link 就是设置 Web App 的放置主屏幕上 icon 文件路径(图片四)。
使用:
1
|
<
link
rel
=
"apple-touch-startup-image"
href
=
"logo_startup.png"
/>
|
说明:这个 link 就是设置启动时候的界面。
使用:
若是对 Web App 的这两个 meta 还有不能详细理解的能够查看官方解释:Meta Tags
关于 link 方面还有更多的参数设置(例如:iPod、iPad、iPhone 不一样尺寸不一样图标),能够查看官方标准文档:Configuring Web Applications
近日以来一直在看JQuery Mobile 一个手机开发框架,说实话真的很头疼的~~~~ 由于里面有不少的属性、方法和事件~~~
转自 http://www.cssue.com/xhtml-css/html5-css3/mobile-meta.html
part3
下面是手机网页的一些认识:
1、<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1">
网页手机wap2.0网页的head里加入下面这条元标签,在iPhone的浏览器中页面将以原始大小显示,并不容许缩放。
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
width - viewport的宽度 height - viewport的高度
initial-scale - 初始的缩放比例
minimum-scale - 容许用户缩放到的最小比例
maximum-scale - 容许用户缩放到的最大比例
user-scalable - 用户是否能够手动缩放
2、<meta name="format-detection" content="telephone=no">
当该 HTML 页面在手机上浏览时,该标签用于指定是否将网页内容中的手机号码显示为拨号的超连接。
在 iPhone 上默认值是:
<meta name="format-detection" content="telephone=yes"/>
若是你不但愿手机自动将网页中的电话号码显示为拨号的超连接,那么能够这样写:
<meta name="format-detection" content="telephone=no"/>
3、<meta name="apple-mobile-web-app-capable" content="yes" />
说明:网站开启对web app程序的支持。
4、<meta name="apple-mobile-web-app-status-bar-style" content="black" />
说明:
注意:若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)。
!!!!苹果web app其余设置:
固然,配合web app的icon 和 启动界面须要额外的两端代码进行设定,以下所示:
<link rel="apple-touch-icon-precomposed" href="iphone_milanoo.png" />
说明:这个link就是设置web app的放置主屏幕上icon文件路径
使用:
<link rel="apple-touch-startup-image" href="milanoo_startup.png" />
说明:这个link就是设置启动时候的界面(图片五),放置的路劲和上面相似。
使用:
5、<meta name="apple-touch-fullscreen" content="yes">"添加到主屏幕“后,全屏显示<meta name="apple-mobile-web-app-capable" content="yes" />
这meta的做用就是删除默认的苹果工具栏和菜单栏。content有两个值”yes”和”no”,当咱们须要显示工具栏和菜单栏时,这个行meta就不用加了,默认就是显示。
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />//将不识别邮箱
告诉设备忽略将页面中的数字识别为电话号码
iOS用rel="apple-touch-icon",android 用rel="apple-touch-icon-precomposed"。这样就能在用户把网页存为书签时,在手机HOME界面建立应用程序样式的图标。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk" />
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="YES">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
----------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="">
----------------------------------------------------------------------------------------------------------------------------
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="viewport" content="width=device-width,maximum-scale=1.0,initial-scale=1.0,user-scalable=no"/>
<meta name="format-detection" content="telephone=no"/>
转自http://blog.163.com/yin_1989/blog/static/1749132082013071924352/