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相干学问,请接见ki4网!
以上就是php网页在手机上摆布不充溢的细致内容,更多请关注ki4网别的相干文章!