溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

php網(wǎng)頁在手機上左右不充滿的方法

發(fā)布時間:2020-10-14 16:21:46 來源:億速云 閱讀:132 作者:小新 欄目:編程語言

這篇文章主要介紹php網(wǎng)頁在手機上左右不充滿的方法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

php網(wǎng)頁在手機上左右不充滿

網(wǎng)頁在手機端顯示,需要設(shè)置一條meta元數(shù)據(jù)(元數(shù)據(jù)又稱中介數(shù)據(jù)、中繼數(shù)據(jù),為描述數(shù)據(jù)的數(shù)據(jù))。這樣網(wǎng)頁的大小就會適應(yīng)我們的手機屏幕,在html的head標簽內(nèi)添加:

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

為了讓網(wǎng)頁在手機端寬度充滿屏幕,我們可以設(shè)置bodycss樣式為

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

另附meta標簽其它常用的屬性用法解析:

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

在手機上瀏覽時,該標簽用于指定是否將網(wǎng)頁內(nèi)容中的手機號碼顯示為撥號的超鏈接。
在 iPhone 上默認值是:

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

如果你不希望手機自動將網(wǎng)頁中的電話號碼顯示為撥號的超鏈接,那么可以這樣寫:

<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”,當(dāng)我們需要顯示工具欄和菜單欄時,這個行meta就不用加了,默認就是顯示。

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

作用是控制狀態(tài)欄顯示樣式:

<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網(wǎng)頁在手機上左右不充滿的方法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI