需要4个标签 然后开始开发
1.添加viewport标签
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
width ---- viewport的宽度(width=device-width意思是:宽度等于设备宽度)
height ------ viewport的高度(height=device-height意思是:高度等于设备宽度)
initial-scale ----- 初始的缩放比例
minimum-scale ----- 允许用户缩放到的最小比例
maximum-scale ----- 允许用户缩放到的最大比例
user-scalable ----- 用户是否可以手动缩放
<
meta
name
=
"format-detection"
content
=
"telephone=no"
/>
<
meta
name
=
"apple-mobile-web-app-capable"
content
=
"yes"
/>
<
meta
name
=
"apple-mobile-web-app-status-bar-style"
content
=
"black"
>
它指定的iphone中safari顶端的状态条的样式
默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)
另外还有一个个性化的link标签,它支持用户将网页创建快捷方式到桌面时,其图标变为我们自己定义的图标。比如手机腾讯网上的标签:
<
link
rel
=
"apple-touch-icon-precomposed"
href
=
"http://3gimg.qq.com/wap30/info/info5/img/logo_icon.png"
>
不过腾讯对这个png图标的命名并不规范,常规我们要求文件名应为 apple-touch-icon.png 或 apple-touch-icon-precomposed.png ,前者的命名iOS会为这个图标自动添加圆角、阴影和高亮覆盖层,后者则不会添加这些效果。
<!doctype html>
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>手机网站</
title
>
<
meta
name
=
"keywords"
content
=
""
/>
<
meta
name
=
"description"
content
=
""
/>
<
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
=
"apple-mobile-web-app-capable"
content
=
"yes"
/>
<
meta
name
=
"apple-mobile-web-app-status-bar-style"
content
=
"black"
>
<
meta
name
=
"author"
content
=
"duanliang, duanliang920.com"
/>
<
style
>
body{font-size:62.5%;font-family:"Microsoft YaHei",Arial; overflow-x:hidden; overflow-y:auto;}
.viewport{ max-width:640px; min-width:300px; margin:0 auto;}
</
style
>
</
head
>
<
body
>
<
div
>
大家好!我是赵祥!
</
div
>
</
body
>
</
html
>
原文:http://www.cnblogs.com/webzx/p/6404639.html