Skip to Content
MOBILE HTML5學習手冊
book

MOBILE HTML5學習手冊

by Estelle Weyl
June 2014
Intermediate to advanced
488 pages
9h 56m
Chinese
GoTop Information, Inc.
Content preview from MOBILE HTML5學習手冊
升級為 HTML5
|
49
大部分行動瀏覽器算繪的預設寬度是 980 px。將寬度設為
device-width
時,使用者就不
需要在網頁載入後放大頁面了,因為你會在 320 px 設備上提供 980 px 寬度。我們可以
將檢視區寬度設為 320 px 320 來取代
device-width
,但如此一來,它就只能在寬度剛
好是 320 px 的行動設備上正確顯示。我們將視窗的寬度設為設備的寬度,這是最佳的
方式:它會將網頁大小適當地調整為設備大小,因此網頁作者不需要知道使用者的設備
寬度。
但是這不一定是所有網站的最佳選擇,它只適合在行動網站與行動 web 應用程式中使
用。當
user-scalable
被啟用時,使用者可以放大頁面,讓無法閱讀小字體的人清晰地
看到頁面。
我們的 CubeeDoo 是一種行動遊戲。當使用者在玩遊戲時,他們會觸碰螢幕,因此我們
不希望使用者在翻牌時不小心縮放頁面,所以我們要求瀏覽器將遊戲的寬度設為螢幕的
寬度,並且不允許縮放。當我們要建立網站,而不是 app 時,可以讓使用者進行縮放,
而不需要限制更佳的操作性,我們在語言選擇器中這麼做:
<meta name="viewport" content="user-scalable=yes,
width=device-width, initial-scale=1.0"/>
viewport
<meta>
標籤是顯示的功能,永遠不會是任何規格的一部分,實際上它是 Apple
發起的一種功能。建構中的規格會使用
@viewport ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JAVASCRIPT網頁應用程式設計

JAVASCRIPT網頁應用程式設計

Alex MacCaw

Publisher Resources

ISBN: 9789863471240