html css 適配手機
例:
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0'/>
<meta name="HandheldFriendly" content="true"/>
<meta name="MobileOptimized" content="320"/>
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta name='apple-mobile-web-app-status-bar-style' content='black' />
<meta name="format-detection" content="telephone=yes"/>
註釋:
1.<meta name="format-detection" content="telephone=yes"/>
在iPhone 手機上預設值是(電話號碼顯示為撥號的超連結):
<meta name="format-detection" content="telephone=yes"/>
可將telephone=no,則手機號碼不被顯示為撥號連結
<meta name="format-detection" content="telephone=no"/>
2.<meta name='apple-mobile-web-app-capable' content='yes' />
Sets whether a web application runs in full-screen mode.
-
- Syntax
-
<meta name="apple-mobile-web-app-capable" content="yes">
- Discussion
-
If
content
is set toyes
, the web application runs in full-screen mode; otherwise, it does not. The default behavior is to use Safari to display web content.You can determine whether a webpage is displayed in full-screen mode using the
window.navigator.standalone
read-only Boolean JavaScript property.
- Availability
-
Available in iPhone OS 2.1 and later.
- Support Level
-
Apple extension.
apple-mobile-web-app-status-bar-style
Sets the style of the status bar for a web application.
-
- Syntax
-
<meta name="apple-mobile-web-app-status-bar-style" content="black">
- Discussion
-
This meta tag has no effect unless you first specify full-screen mode as described in
If
content
is set todefault
, the status bar appears normal. If set toblack
, the status bar has a black background. If set toblack-translucent
, the status bar is black and translucent. If set todefault
orblack
, the web content is displayed below the status bar. If set toblack-translucent
, the web content is displayed on the entire screen, partially obscured by the status bar. The default value isdefault
.
- Availability
-
Available in iPhone OS 2.1 and later.
- Support Level
-
Apple extension.
format-detection
Enables or disables automatic detection of possible phone numbers in a webpage in Safari on iPhone.
-
- Syntax
-
<meta name="format-detection" content="telephone=no">
- Discussion
-
By default, Safari on iPhone detects any string formatted like a phone number and makes it a link that calls the number. Specifying
telephone=no
disables this feature.
- Availability
-
Available in iPhone OS 1.0 and later.
- Support Level
-
Apple extension.
這個viewport的元標記是許多智慧電話上的支援,從iPhone到Android的webOS(PALM)甚至InternetExplorer Mobile中的Opera Mini和Opera Mobile。
以下是m.yahoo.com上的viewport標記
- <metaname="viewport"content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
在上面這個程式碼中,禁止使用者進行縮放,你也可以允許讓使用者自行縮放,程式碼如下:
- <metaname="viewport"content="width=device-width, initial-scale=1.0"/>
由於viewport標記並不是所有瀏覽器都支援,當以上程式碼無效時,你可以嘗試通過其它方式實現,如下:
- <metaname="HandheldFriendly"content="true"/>
或者
- <metaname="MobileOptimized"content="320"/>
最後,如果你的網頁中的DOCTYPE是XHTML-MP或WML,您的網站將被認定為一個移動優化網站。
Android上的規則屬性
官方Android文件中列出了一個特殊的屬性,Android已經加入到meta標籤:target-densitydpi。這個屬性允許開發人員指定螢幕解析度頁面已開發的,或者更具體如何處理的媒體,如影象的縮放。
這裡有一個Android下的viewport標籤的例子:
- <metaname="viewport"content="target-densitydpi=device-dpi"/>
相關推薦
html css 適配手機
例: <meta charset='utf-8' /> <meta name='viewport' content='width=device-width, initial-scale=1.0'/> <meta
HTML頁面適配手機移動端視窗寬度
隨著網路的快熟發展,越來越多的人使用手機上網。移動裝置正超過桌面裝置,成為訪問網際網路的最常見終端。於是,網頁設計師不得不面對一個難題:如何才能在不同大小的裝置上呈現同樣的網頁?手機的
html 適配手機端,使用media方式(個人記錄)
適配手機: @media only screen and (min-device-width: 320px) and (max-device-width:360px) and (-webkit-min-device-pixel-ratio: 2) {.ui-markett
51CTO博客發布H5移動版(適配手機)2017.5.17
51cto博客 移動站 各位,51CTO博客於5月17日發布H5移動版,可以適配手機和平板,分享文章到手機,閱讀體驗更佳,掃碼可以進入(進入後,可以收藏到瀏覽器或展示在手機桌面,以後可以打開進入博客): 後續我們還會繼續優化移動站的首頁,也歡迎廣大博友的建議和意見。51CTO博客發布H5移
css適配ios Android
webkit 出現 -h color lin tap light 點擊 spa input{ -webkit-tap-highlight-color:transparent;/**ios下面input選中會出現短暫的陰影**/ outline: none;/**清
7個步驟讓PC網站自動適配手機網頁
on() 開發 應用 網頁 con 像素 取消 ica 引入 傳統的網站如何完成向移動設備的快速轉型? 通過移動適配技術可以實現,切圖網是國內首家基於web技術服務的公司,而移動適配主要通過底層的web技術開發手段來完成,下面切圖網將從技術角度來告訴你通過7個步驟來完成一個
rem + media 的css適配程式碼
公式 :fontSize = 螢幕寬度 * 100 / 設計圖寬度 ,設定為100是方便計算; 轉換成 rem 除以 100 即可得到, 這裡的設計圖寬度是640px ,當螢幕寬度等於640px時 font-size = 100px,1rem = 100px ,拿
css適配不同解析度螢幕
如今的螢幕解析度,小至320px(iPhone),大到2560px甚至更高(大顯示器),變化範圍極大。除了使用傳統的桌上型電腦,使用者會越來越多的通過手機、上網本、iPad一類的平板裝置來瀏覽頁面。這種情況下,固定寬度的設計方案將會顯得越發不合理。頁面需要有更好的適應性,其佈
html5適配手機螢幕
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes"
webview 中使用css適配簡單的頁面
package com.example.mycssdemo; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import and
HTML+CSS PC端 手機端 公用部分樣式程式碼整理
1、css常用公用部分樣式程式碼整理:body, html, div, blockquote, img, label, p, h1, h2, h3, h4, h5, h6, pre, ul, ol, li, dl, dt, dd, form, a, fieldset, input, th, td {mar
Android適配手機與平板螢幕尺寸
一.劃分手機和平板 人為判斷方法: 大於6英寸的就是平板。小於6英寸的都是手機 平板尺寸: 6英寸、7英寸、10英寸、14英寸… Android系統支援多配置資原始檔,我們可以追加新的資源目錄到你的Android專案中。命名規範: 資源
Rem-- ui圖與適配手機的px換算
找了很多的文件,就這個問題,越看越糊塗,寫的公式都是直接給出,但是並沒有說公式是怎麼推演出來的,搞得我好煩。rem =x/75, 實在搞不懂,就自己寫了, 大家都明白,假設html的fontSize:16px;那麼1rem = 16px;是不是可以理解為1個rem單位等於16px; 以750的設計稿為例:
H5方面(H5適配手機螢幕等)
一個html頁,其文字包含三個方面的資訊,邏輯,內容,樣式。其中邏輯部分決定頁面和使用者互動的行為,樣式部分決定使用者介面的視覺表現,內容部分是結構化的文字資訊。對於一個以內容為主的頁面(區別於富互動應用/webapp)來說,在表現內容的html中,插入表現邏輯的js
對於iphone X 相容性處理的css適配方法和js適配方法
1. 如果想全屏覆蓋,html裡面請使用 <meta name="viewport" content="width=device-width,initial-scale=1,viewport-
Fragment同時適配手機和平板兩種螢幕
Fragment對於Android開發來說,是一個必不可少的工具,我們使用這個工具可以輕鬆應對很多介面管理上的問題,例如如何分屏,如何移除介面和替換介面等。更為神奇的是,我們可以結合Android系統的特性和Fragment來實現一個工程適應手機平板兩種螢幕
Canvas適配手機端
Canvas適配困境 最近做了個H5小遊戲,它的主頁的html程式碼如下: <<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8
適配手機端的幾種寫法
1,rem佈局,現在普遍常用的方法 一般ui設計師給的頁面都是640的,所以document.documentElement.clientWidth/6.4+"px";專案中,在ps中量的尺寸直接除以
Android 本地HTML螢幕適配的一種方案
前言:在Android開發中WebView載入網頁,網頁的適配應該是前端來處理的,畢竟客戶端的對網頁的控制是有限的。但是如果有一個本地的網頁而且該網頁的body是固定寬度的,讓我們去適配所有裝置還是比較頭疼的,當然這種應用場景是很罕見的,儘管如此我們還是討論
web適配手機端開發總結
現在手機端也業務要多於pc端,如何做手機端的web頁面也成了許多web前端工程師的必修課,以下是我總結的一些心得,大家茶餘飯後研讀一下,看看能不能漲漲姿勢。適配手機端我主要總結3點:1. 在頁面頂部加meta,它的大概意思就是讓頁面1:1顯示,使用者禁止縮放。<meta