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
Styling the Shadow Dom
Search
Andres Galante
September 26, 2016
Technology
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Styling the Shadow Dom
Tiangle JS meetup talk about how to style the shadow DOM
Andres Galante
September 26, 2016
Transcript
33 slides
@andresgalante Shadow Dom
None
Shadow Dom
Heads Up
1. Never trust an Argentinean designer writing code.
1. Never trust an Argentinean designer writing code.
2. I am a Shadow Dom rookie
Shadow Dom
Custom elements + Shadow DOM = Self contained HTML, CSS
and JS
None
None
CSS
The Shadow DOM
The ShadowRoot A shadow root is a document fragment that
gets attached to a “host” element.
Light DOM + Shadow DOM = Composed DOM
<slot> Placeholders inside your component that users can fill with
their own markup.
How to style the ShadowDOM
None
None
None
None
None
CSS selectors from the outer page don’t apply inside your
component. Styles defined inside don’t bleed out. They’re scoped to the host element.
:host(<selector>) selector Allows you to target the host if it
matches a <selector>.
::host-context(<selector>) selector Matches the component if it or any of
its ancestors matches <selector>.
:slotted(<compound-selector>) selector Matches nodes that are distributed into a <slot>
Styling a component from the outside.
Style hooks using CSS custom properties CSS variables and mixins
Access Card Demo Putting everything together
None
Can we use it?
maybe
Thanks :)
More Decks by Andres Galante
See All by Andres Galante
Make Something Great! Become an Open Source Contributor
andresgalante
0
230
Make Something Great: Become an Open Source Contributor
andresgalante
0
310
How to use CSS to make your App look amazing and be accessible on any device
andresgalante
0
92
Open source - JUG BA
andresgalante
0
88
Open source - QCon19
andresgalante
0
120
CSS - Media queries o tamanho não importa
andresgalante
0
110
Cosmos
andresgalante
0
130
PatternFly 4 variable system
andresgalante
0
120
Open source
andresgalante
3
110
Other Decks in Technology
See All in Technology
ワークフローからハーネスへ — Web フレームワークの作者たちが AI エージェントに向かう理由
azukiazusa1
2
800
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
3
920
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
320
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
440
AIエージェントのアーキテクチャ設計
nsatoh
0
540
メルカリの小規模チーム「Pod」で、 エンジニアがデータアナリストなしで、 AIを使ってデータ分析の自走を目指す取り組み
jackojacko_
1
350
現地速報! Microsoft Ignite アップデートレポート
kasada
1
460
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
500
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
180
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
400
OCI Artifact による自動運転タクシーに向けた OTA 基盤の構築
biwashi
1
300
認知の質も文化醸成も。数年取り組んで見えてきた技術広報のKPI設計 / Tech PR KPIs: Lessons on Awareness Quality and Culture After Several Years
bitkey
PRO
0
210
Featured
See All Featured
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
580
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
680
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
A designer walks into a library…
pauljervisheath
211
25k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.9k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
340
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
470
Producing Creativity
orderedlist
PRO
348
41k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
640