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
Démystifions les CSS Custom Properties
Search
Audrey Garreau
June 13, 2018
Programming
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Démystifions les CSS Custom Properties
Audrey Garreau
June 13, 2018
More Decks by Audrey Garreau
See All by Audrey Garreau
Donner du sens à vos pages web avec Schema.org
agarreau
0
350
Other Decks in Programming
See All in Programming
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
460
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
sbt 2.0: takeoff
eed3si9n
0
160
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
220
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.1k
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
910
残高管理から台帳サービスへの進化
artoy
1
200
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
First, design no harm
axbom
PRO
2
1.3k
The browser strikes back
jonoalderson
0
1.8k
Side Projects
sachag
456
43k
Balancing Empowerment & Direction
lara
6
1.3k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
GraphQLとの向き合い方2022年版
quramy
50
15k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Transcript
Démystifions les CSS Custom properties
CSS Variables Non, on dit CSS Custom Properties ! 1
Déclaration // Déclaration * { --myvar : #FFF; } //
Utilisation body { background : var(--myvar); }
Déclaration // Déclaration * { --myvar : #FFF; } //
Utilisation body { background : var(--myvar); }
Demo Time ! Attention, vous allez en avoir plein le
css ! https://bit.ly/2LCyfK8
Compatibilité des navigateurs Custom Properties 49 31 16 9.1 @Support
28 22 13 9 Polyfill IE 11 : ShadyCSS
Gestion avec @Support body { background : red; } @support(--color)
{ :root { --color : #FFF; } body { background : var(--color, red); } }
Gestion avec @Support body { background : red; } @support(--color)
{ :root { --color : #FFF; } body { background : var(--color, red); } }
Limites Et oui, on peut pas tout faire avec... 2
Demo Time ! C’est aussi par ce qu’on aime le
risque https://bit.ly/2kWlIWy
Les utilisations avancées = Et vos pages sont plus réactives
3
Demo Time ! Une démo qui ne plante pas n’est
pas une vrai démo ! https://bit.ly/2Jrg3X6
Et ensuite C’est quoi la suite ? 4
Le problème de surchage <my-component> #shadow-root <!-- Overridable part--> <div>
<span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // Style my-component :root { --a-color
: orange; } span { color : var(--a-color); } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // index.css my-component span:hover { --a-color
: red } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // Style my-component :root { --a-color
: orange; } span { color : var(--a-color); } :root span:hover { color : var(--a-color-hover); //red } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // index.css my-component{ --a-color-hover : red
} <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // index.css my-component:focus span:hover { --a-color
: blue } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // Style my-component :root { --a-color
: orange;} span { color : var(--a-color); } :root:hover span { color : var(--a-color-hover); } :root:focus span:hover { color : var(--a-color-hover-focus); //blue } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
Le problème de surchage // index.css my-component{ --a-color-hover : red;
--a-color-hover-focus : blue; } <my-component> #shadow-root <!-- Overridable part--> <div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
::part & ::theme la relève <my-component> #shadow-root <!-- Overridable part-->
<div> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
::part & ::theme la relève <my-component> #shadow-root <!-- Overridable part-->
<div part=”part-name”> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
::part & ::theme la relève <my-component> #shadow-root <!-- Overridable part-->
<div part=”part-name”> <span>...</span> </div> <!-- Non overridable part--> <section>...</section> </my-component> Override Me Don’t Override Me
::part & ::theme la relève // index.css my-component::part(part-name) { --my-color:
blue; } my-component::part(part-name):hover { --my-color: red; font-style: italic; } Override Me Don’t Override Me Override Me Don’t Override Me
Custom Type le problème // main.css body { --my-color: orange;
--my-color: url("https://web2day.co/logo.svg"); color: var(--my-color); }
Custom Type pour typer // main.js CSS.registerProperty({ name: "--my-color", syntax:
"<color>", initialValue: "black" });
Merci ! Des questions ? Audrey Garreau CEO Yumigo -
@garreau_audrey - @yumigoteam Jean-François Garreau CTO Sfeir Nantes / GDE Web Technology - @jefbinomed