移动端开发常用设置。

以前好像也写过移动端开发的一些设置,但是零零散散的,这次想总结起来,免得自己又忘了!

1.移动端meta常见设置及释义

<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detecation">
<meta content="yes" name="app-mobile-web-app-capable">
//当网站添加主屏幕快速启动方式,可以隐藏地址栏(苹果)。
<meta content="black" name="app-mobile-web-app-status-bar-style">
//当网站添加主屏幕快速启动方式,显示状态栏的样式(苹果)。
代码释意
width=device-width设置视口宽度等于设备宽度
initial-scale=1.0初始化不缩放
maximum-scale=1.0最大缩放比例1
user-scalable=no禁止用户缩放页面
telephone=no忽略页面中数字识别为电话
email=no忽略页面中邮箱识别
Iphone54英寸640*1136326ppi
Iphone64.7英寸750*1334326ppi
Iphone75.5英寸1080*1920406ppi

2.移动端通过css媒体查询适配不同dpr的手机样式写法示例:

.box{
	width:375px;
	background-image:url('img_2x.png')
}

@media only screen(device-width:375px) and (-webkit-min-device-pixel-ratio:3){
	.box:{
		width:125px;
		background-image:url('img_3x.png')
		}
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值