Skip to Content
MOBILE WEB程式設計--第二版
book

MOBILE WEB程式設計--第二版

by Maximiliano Firtman
December 2013
Intermediate to advanced
752 pages
16h
Chinese
GoTop Information, Inc.
Content preview from MOBILE WEB程式設計--第二版
行動瀏覽器 CSS
|
407
不建議在大型的檔案或照片使用 CSS sprites。如果你使用的是 PNG
像,最佳的方式是以顏色一致的色板來將圖示群組化。
CSS Sprites 替代方案
即使你不想要使用 CSS sprites,但降低請求伺服器的次數仍然是一種很有吸引力的概
念,因此在某些特別的情況下,我們會尋求這項技術替代方案。
提到 CSS sprites 替代方案,腦海中浮現的第一種技術是影像地圖。但是
不建議在非觸控導覽使用它們,因為在非觸控設備上,影像地圖會對使用
性造成負面的影響。
內嵌圖像
如上一章所述,內嵌圖像對相容的瀏覽器而言是項很棒的技術。當我們為可瞭解它們的
瀏覽器進行設計時,可以複製第一個樣本(沒有 CSS sprites 的原始文件)並以
data:
取代每一張圖像的 URL
結合圖像
如果圖像之間的上下或左右距離非常靠近,如我們的範例所示,可考慮將所有圖像結合
為一張。這個概念與 CSS sprites 很類似,但我們將圖像設定為單一用途的背景,調整邊
距與內距,讓元素適當地對齊圖像的各個部分。在對邊距與內距的支援有限的舊式設備
上,這項技術會產生不良的結果。
如果我們使用原始的程式碼,但在伺服器上定義一個良好的快取策略,這
個網站的網頁載入速度會比使用 CSS sprites 的時候快,因為此時不需要
進行轉譯。
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

成為卓越程式設計師的38項必修法則

成為卓越程式設計師的38項必修法則

Pete Goodliffe
精實企業|高績效組織如何達成創新規模化

精實企業|高績效組織如何達成創新規模化

Jez Humble, Joanne Molesky, Barry O'Reilly

Publisher Resources

ISBN: 9789862769522