What exactly is :root selector in CSS?

  Рет қаралды 5,921

CSS Weekly

CSS Weekly

Күн бұрын

A brief guide outlining how :root pseudo-class in CSS works, where it's often used and why, along with potential pitfalls.
🔗 Links
CodePen Demo: codepen.io/ZoranJambor/pen/Jj...
Custom Properties on :root Issue: github.com/w3c/csswg-drafts/i...
::selection background not visible issue: github.com/eslint/eslint.org/...
📖 Timestamps
00:00 What is :root pseudo-class
01:06 How :root in SVG works
03:21 Tip: Don’t define all your variables on :root
04:23 Pitfalls with :root inheritance
05:09 Should you use :root in your CSS?
Subscribe to CSS Weekly Newsletter:
💌 css-weekly.com/
Course Mastering Prettier & Stylelint
🔥 Learn everything about best linting tools while supporting CSS Weekly: masteringlinting.com/
🏷️ Use coupon code KZfaq15 to get an additional 15% off on the already discounted, pre-launch price.
Keep up-to-date with CSS Weekly:
👉 Twitter: / cssweekly
👉 Instagram: / cssweekly
👉 Facebook: / cssweekly
Keep up to date with what I'm up to:
🔗 Blog: zoranjambor.com
👉 Twitter: / zoranjambor
👉 LinkedIn: / zoranjambor
- Zoran Jambor
#css #cssselectors

Пікірлер: 22
@CeeTheJay
@CeeTheJay Жыл бұрын
I appreciate how you break things down so clearly. Definitely helpful. Thank you, Zoran!
@CSSWeekly
@CSSWeekly Жыл бұрын
Thank you so much for the kind words! I’m thrilled to hear that it’s clear! 🙂
@D7460N
@D7460N Жыл бұрын
Very good. Thank you for posting.
@CSSWeekly
@CSSWeekly Жыл бұрын
Thanks so much for watching and commenting! 🙏
@JohnnyB.Good10
@JohnnyB.Good10 Жыл бұрын
good to know!👍👍
@CSSWeekly
@CSSWeekly Жыл бұрын
Thank you, I’m glad to hear you found it useful! 🙂
@ScriptRaccoon
@ScriptRaccoon Жыл бұрын
I didn't know that tbh! I just put the variables on the :root since everybody did that and it worked globally. I wondered if it would make any difference to put the variables on the body tag? I mean, this is where we want to style things, right?
@CSSWeekly
@CSSWeekly Жыл бұрын
I’m glad to hear you learned something! 🙏 Sure, you can put variables on body tag, it won’t make any practical difference, I think. 🙂
@bogdanlazy1997
@bogdanlazy1997 7 ай бұрын
Man, u look incredible! btw thanks for video
@CSSWeekly
@CSSWeekly 7 ай бұрын
Thanks! 🙏 This was actually recorded before I turned 40-so check out new videos, I look even more incredible now! 😉
@AdilKhan-vf2es
@AdilKhan-vf2es 9 ай бұрын
Good stuff bro
@CSSWeekly
@CSSWeekly 9 ай бұрын
Thank you so much, my friend! 🙏
@activenode
@activenode Жыл бұрын
Nice one.
@CSSWeekly
@CSSWeekly Жыл бұрын
Thank you so much for watching and for your nice comment! 🙂
@jmsherry
@jmsherry 3 ай бұрын
Slightly tangential: I keep seeing videos where the camera is inset as a circle and also a few times where you highlight blocks of code (e.g. 38s in): I was wondering what software is used to so that? (I think it'd be handy for me when explaining things at work to others). Thanks! :)
@CSSWeekly
@CSSWeekly 3 ай бұрын
Thanks for your question, James! 🙏 I'm using Screenflow to record and edit my KZfaq videos, so I do all of this manually. There are some practical apps like Loom that make this a bit easier. I used Loom at work precisely to demonstrate/explain things to others quickly. 🙂
@jmsherry
@jmsherry 3 ай бұрын
@@CSSWeekly That's awesome! Thank you for the tips! :)
@CSSWeekly
@CSSWeekly 3 ай бұрын
You're very welcome, James! 🙂
@codeforest468
@codeforest468 Жыл бұрын
Nice video, again. Keep up the good work.. Also, first again!
@CSSWeekly
@CSSWeekly Жыл бұрын
Thanks, Zvonko! ❤️
@JoshuaCodes
@JoshuaCodes Жыл бұрын
Shouldn't the title say: What exactly is :root pseudo-class in CSS? as :root is a pseudo-class & not a pseudo-element.
@CSSWeekly
@CSSWeekly Жыл бұрын
Oh my, indeed it should. That’s a significant blunder. 🫣 I’ll change it immediately. Thanks for pointing it out, Joshua! 🙏
CSS Quick-Tip: Custom Properties Fallback Values
2:09
CSS Weekly
Рет қаралды 1 М.
In-Depth Guide to CSS Logical Properties
22:35
CSS Weekly
Рет қаралды 7 М.
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 15 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 51 МЛН
Learn CSS Variables in 15 Minutes
16:59
dcode
Рет қаралды 5 М.
Simplify Your CSS Using :is() and :where() Pseudo-Classes
9:22
CSS Weekly
Рет қаралды 1,5 М.
2 better alternatives to overflow: hidden
11:04
Kevin Powell
Рет қаралды 153 М.
Single CSS keyframe tricks are magic
52:02
Bad at CSS
Рет қаралды 3,7 М.
Transition to "height: auto;" & "display: none;" Using Pure CSS
10:14
10 CSS Pro Tips - Code this, NOT that!
9:39
Fireship
Рет қаралды 2,1 МЛН
Learn CSS Pseudo Elements In 8 Minutes
7:50
Web Dev Simplified
Рет қаралды 252 М.
The problems with viewport units
13:23
Kevin Powell
Рет қаралды 356 М.
The new CSS pseudo-classes explained - :is() :where() :has()
13:50
Kevin Powell
Рет қаралды 132 М.
Learn Flexbox CSS in 8 minutes
8:16
Slaying The Dragon
Рет қаралды 1,5 МЛН
ГОСЗАКУПОЧНЫЙ ПК за 10 тысяч рублей
36:28
Ремонтяш
Рет қаралды 281 М.
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 346 М.
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 23 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 3,2 МЛН
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 6 МЛН