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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.2k
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
200
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
160
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
160
AHC070解法紹介
eijirou
0
110
アクセシビリティから考える情報設計
high_g_engineer
0
370
Building an Out-of-Order CPU
latte72
1
770
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
190
Java 27新機能 / Java 27 new features
kishida
2
120
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
160
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
590
A Modern Web Designer's Workflow
chriscoyier
699
190k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Heart Work Chapter 1 - Part 1
lfama
PRO
9
36k
What's in a price? How to price your products and services
michaelherold
247
13k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Ruling the World: When Life Gets Gamed
codingconduct
0
330
Building an army of robots
kneath
306
46k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
740
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
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