Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Resep Rahasia CSS Custom Properties
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yudhi Satrio
June 21, 2020
Programming
190
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Resep Rahasia CSS Custom Properties
Mengatur strategi dalam menerapkan CSS Variable agar lebih dinamis
Yudhi Satrio
June 21, 2020
More Decks by Yudhi Satrio
See All by Yudhi Satrio
Membangun Situs Web yang Ramah Aksesibilitas
isatrio
0
130
Membuka Peluang Karier Internasional
isatrio
0
91
Membuat Tema dan Plugin yang Ramah Pengguna
isatrio
0
30
SEO
isatrio
0
65
Front_End_Developer_Weapons_in_GNOME.pdf
isatrio
0
87
A Healthy Everyday Git Commit
isatrio
0
140
Serba-serbi Menerapkan A11y Dalam Situs Web
isatrio
0
370
Understanding How People with Visual Impairments Using Screen Reader
isatrio
0
41
Assistive Technology Built-in on GNOME
isatrio
0
220
Other Decks in Programming
See All in Programming
Vite+ Unified Toolchain for the Web
naokihaba
0
290
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
750
Creating Composable Callables in Contemporary C++
rollbear
0
110
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.7k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
220
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
780
Agentic UI
manfredsteyer
PRO
0
150
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
170
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
110
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.5k
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
200
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
150
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
The Limits of Empathy - UXLibs8
cassininazir
1
360
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
230
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Cult of Friendly URLs
andyhume
79
6.9k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Being A Developer After 40
akosma
91
590k
Building Applications with DynamoDB
mza
96
7.1k
Transcript
https://app.sli.do/event/46fzj4qa
Resep Rahasia CSS Custom Properties Oleh isatrio - CC-by-SA 4.0
license
Selamat datang developer LEMAH yang kalau bikin situs web pakai
Bootstrap -- Pinjem Coki Anwar
CSS itu mudah!
Siapa yang bilang?
CSS itu “TRICKY”!
Saya adalah tim “CSS adalah bahasa pemrograman”
1. CSS enggak punya variabel 2. CSS itu bahasa komputer
untuk menginstruksikan komputer untuk merender gaya
Saya adalah orang pertama yang skeptis dengan variabel css, karena
saya adalah pengguna css-preprocessor
Variabel dari CSS Preprocessor
Assign variabel
https://codepen.io/isatrio/pen/yLeMLPg Hasil kompilasi
CSS Custom Properties Variabel
Assign variabel Nilai bawaan bila nilai variabel kosong Deklarasi nilai
variabel
Implementasi Variabel
None
None
Tidak valid
Invalid Invalid
Valid
None
Preprocessor variabel itu statis
None
Variabel CSS itu dinamis
None
Global dan Lokal
None
Terkadang variabel lokal juga masih perlu diimplementasikan
Mengaduk ramuan variabel statis dengan variabel dinamis
Variabel sass statis Variabel css dinamis Implementasi nilai variabel
“Jangan lakukan pada saat runtime, lakukanlah pada saat mendesain” --
Bill Sourour
None
None
Pisahkan antara desain dan logika
None
None
Jangan mengubah tema warna secara langsung
None
Memperbarui nilai menggunakan JS
None
None
Komponen VueJS https://codepen.io/isatrio/pen/MWKpjar
Referensi 1. Smashing Book 6: New Frontiers In Web Design
Bab “A Strategy Guide to CSS Custom Properties” oleh MIKE RIETHMULLER 2. Using CSS custom properties MDN 3. Don’t do it at runtime. Do it at design time oleh Bill Sourour