Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Using RGBA Colour The Bagpuss Way
Search
Drew McLellan
September 27, 2011
Technology
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Using RGBA Colour The Bagpuss Way
From Oxford Geek Night.
Drew McLellan
September 27, 2011
Transcript
29 slides
Using RGBA Colour The Bagpuss Way Oxford Geek Night 10
- 21 January 2009 Drew McLellan, edgeofmyseat.com
There are lots of different ways to specify colours in
CSS
fuchsia #FF00FF #F0F rgb(255, 0, 255) rgb(100%, 0, 100%)
However you write it, they’re identical colours. (it’s all the
same biscuit)
They all have one other important aspect in common.
These all specify solid colours.
CSS3 introduces rgba()
Red Green Blue Alpha (opacity)
rgba(255, 255, 255, 0.5)
rgba(255, 255, 255, 0.5)
But that’s what CSS3 opacity does isn’t it?
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
Opacity affects the entire object Hello world Hello world
RGBA is about the opacity of a colour Hello world
Hello world Hello world
Pink stripes 100% opacity
Entire Bagpuss 50% opacity
Pink stripes 50% opacity, as nature intended
Closer to a tiled, flat colour semi-transparent PNG, without the
image.
... but also works for text, borders, foregrounds, backgrounds, playgrounds.
(maybe not playgrounds)
How?
rgba(255, 255, 255, 0.5)
Browser support is ok, but not great.
Firefox 3 Safari 3 Opera 10
So how can we use this today without ending up
with a nasty old mess in rubbish old browsers that don’t support all this lovely RGBA stuff?
None
Fall back to solid colour background: rgb(187, 192, 187); background:
rgba(120, 130, 120, 0.5);
Fall back to alpha PNG background: transparent url(green50.png); background: rgba(120,
130, 120, 0.5) none;
Tell me more! http://allinthehead.com/code/rgba/ http://dorward.me.uk/www/css/alpha-colour/
allinthehead.com/presentations Thank you. twitter.com/drewm
More Decks by Drew McLellan
See All by Drew McLellan
HTML5 APIs PHP Yorkshire 2017
drewm
1
250
HTML5 APIs Confoo Montreal
drewm
1
300
PHP Payments with Omnipay
drewm
0
140
HTML5 APIs Confoo Vancouver
drewm
0
300
Learn to Love Regular Expressions
drewm
0
200
Ecommerce Projects with Moltin
drewm
0
710
Writing Portable PHP
drewm
0
160
Getting to Grips with Regular Expressions
drewm
1
300
Back to Front Performance - Oct 2013
drewm
0
140
Other Decks in Technology
See All in Technology
Agent Routerで作るマルチテナント 推論基盤 #CNDW2026 / Building Multi-Tenant Inference Platform with Agent Router #CNDW2026
everpeace
5
580
設計手法を「道具」として使いこなすために
a_suenami
7
1.6k
文書画像からの情報抽出を行うエージェントを、軌跡の正解データ無しで作れるか
sansantech
PRO
2
220
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
650
業務の傍らで進める改善ループエンジニアリング
bengo4com
1
230
Kansai WordPress Meetup@大阪『ブロックテーマを作る上で知っておくべきこと
torounit
0
260
Kubernetes, Agones, WebRTC, GPU で作る クラウドゲーミング基盤を本番運用に乗せるまで
vivion
0
240
お風呂場をサーバルームにしよう
yusuke427
0
390
人の努力に頼らないセキュリティをエンジニアリングする在り方 / An approach to engineering security that does not rely on human effort
carta_engineering
0
240
Dark Web - Como o Cibercrime Opera na Internet
nicholsjasper
0
100
NutanixへのSSHアクセスの今後について
shadowhat
0
130
Gov-JAWS#9 統合監視機能のマネージドサービス化+AIによる障害時自動調査
fj_yoshimura_kosuke
0
230
Featured
See All Featured
A better future with KSS
kneath
240
18k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
490
Docker and Python
trallard
47
4.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
Are puppies a ranking factor?
jonoalderson
2
4.2k
Making the Leap to Tech Lead
cromwellryan
135
10k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k