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學習手冊
242
|
第八章
錯誤:
rgb(255, 100%, 255);
使用 RGBA 來添加透明度
RGBA CSS3 新增的功能,它類似 RGB,但加入代表 Alpha 透明度的 A
rgb()
規格經過擴充之後,在 CSS3 加入
rgba()
來納入 Alpha,讓我們可以指定顏色的
透明度。它前面的三個顏色仍然是紅、綠、藍,第四個值是不透明度。1 代表完全不透
明,0 代表完全透明,0.5 代表 50% 不透明。你可以使用任何浮點數,包括 0 1
就之前的白色範例而言,1 的不透明度代表完全不透明,因此下列程式是與它完全相同
的:
rgb(255, 255, 255)
rgb(100%, 100%, 100%)
rgba(255, 255, 255, 1)
rgba(100%, 100%, 100%, 1)
它們都是白色,因為 1 代表完全不透明。但是
rgba(0, 0, 0, 0)
是透明的,而不是黑
色,因為不透明度是零。
請注意,關鍵字
transparent
是透明的黑色,等於
rgba(0, 0, 0, 0)
,而不
rgba(255, 255, 255, 0)
,如果你要轉換顏色,這會產生很大的差異。
8-1 說明
rgba(0, 0, 0, 1)
是完全不透明的黑色。當你減少 Alpha 透明值時,它愈靠
近零,就愈透明。在圖 8-1 中,你可以看到如果宣告較透明的背景顏色的話,背景圖片
會比較清楚。
RGBA 非常適合用來製作元素的陰影。文字或方塊陰影會在幾個像素之內
從宣告的顏色逐漸變成完全透明。你可以在一開始用半透明來取代純色, ...
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