移动端 页面初尝试(一)

第一次写移动端的页面

1、基本在网页头部我们只需添加四个meta标签就可以实现一个手机网站的框架。我一起来看看是哪些meta标签。

<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 ----- 用户是否可以手动缩放

 2、禁止将数字变为电话号码

<meta name="format-detection" content="telephone=no" />

 一般情况下,IOS和Android系统都会默认某长度内的数字为电话号码,即使不加也是会默认显示为电话的,so,取消这个很有必要!

3、iphone设备中的safari私有meta标签

<meta name="apple-mobile-web-app-capable" content="yes" />

 它表示:允许全屏模式浏览,隐藏浏览器导航

4、iphone私有标签

<meta name="apple-mobile-web-app-status-bar-style" content="black">

 它指定iphone中safari顶端的状态条样式 默认为default 白色  可以定位black黑色和black-translucent(灰色半透明)

<link rel="apple-touch-icon-precomposed" href="http://3gimg.qq.com/wap30/info/info5/img/logo_icon.png">

 这是一个个性化的link标签,他支持用户将网页创建快捷方式到桌面其图标为我们自己定义的图标

 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>

 三、关于手机网站调试问题

一般我们采用的:在浏览器调试+真机测试,因为浏览器毕竟只是一个模拟工具,实际开发的话,我们还得用真机去测试。

 比如:(Android类手机,iPhone5、5s、6、6Plus...)

 而在浏览器上测试,可以chrome(谷歌浏览器)的F12调试工具:有个手机样的小图标,点击就能模拟手机测试。

转载于:https://www.cnblogs.com/barrie/p/4914348.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值