您好,欢迎来到车荣汽车网。
搜索
您的当前位置:首页php网页在手机上左右不充满

php网页在手机上左右不充满

来源:车荣汽车网


php网页在手机上左右不充满

网页在手机端显示,需要设置一条meta元数据(元数据又称中介数据、中继数据,为描述数据的数据)。这样网页的大小就会适应我们的手机屏幕,在html的head标签内添加:

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

为了让网页在手机端宽度充满屏幕,我们可以设置body的css样式为

body{
 padding: 0;
 margin: 0;
 width: 100%;
}

另附meta标签其它常用的属性用法解析:

1、<meta name="format-detection"/>

在手机上浏览时,该标签用于指定是否将网页内容中的手机号码显示为拨号的超链接。
在 iPhone 上默认值是:

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

如果你不希望手机自动将网页中的电话号码显示为拨号的超链接,那么可以这样写:

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

2.<meta name="apple-mobile-web-app-capable"/>

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

这apple-mobile-web-app-capable的作用就是删除默认的苹果工具栏和菜单栏。content有两个值”yes”和”no”,当我们需要显示工具栏和菜单栏时,这个行meta就不用加了,默认就是显示。

3.<meta name="apple-mobile-web-app-status-bar-style"/>

作用是控制状态栏显示样式:

<meta name=”apple-mobile-web-app-status-bar-style” content=”default” />
<meta name=”apple-mobile-web-app-status-bar-style” content=”black” />
<meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent” />

default:默认; black:纯黑; black-translucent:半透明灰色

更多PHP相关知识,请访问PHP中文网!

Copyright © 2019- carofchina.com.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务