Тёмный

Simplify your CSS selectors 

Kevin Powell
Подписаться 919 тыс.
Просмотров 101 тыс.
50% 1

Simplify your CSS Selectors with :is() and :where()
Join the Discord Community: / discord
#css #shorts
--
Come hang out with other dev's in my Discord Community
💬 / discord
Keep up to date with everything I'm up to
✉ www.kevinpowell.co/newsletter
Come hang out with me live every Monday on Twitch!
📺 / kevinpowellcss
---
Help support my channel
👨‍🎓 Get a course: www.kevinpowell.co/courses
👕 Buy a shirt: teespring.com/stores/making-t...
💖 Support me on Patreon: / kevinpowell
---
My editor: VS Code - code.visualstudio.com/
---
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my RU-vid channel, make sure to follow me on Instagram and Twitter.
Twitter: / kevinjpowell
Codepen: codepen.io/kevinpowell/
Github: github.com/kevin-powell
---
And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

Опубликовано:

 

23 авг 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 89   
@KevinPowell
@KevinPowell Год назад
Join my Discord Community: discord.gg/9Rc6WNhNGJ
@AJman14
@AJman14 Год назад
This one is actually really good. It's like wildcards but with CSS.
@Zuzki507
@Zuzki507 Год назад
Everytime css is more like sass
@SXsoft99
@SXsoft99 Год назад
Meanwhile me still writing sass
@Zeragamba
@Zeragamba Год назад
I'd say this is a lot more readable then native CSS: .themeSelection { &.light, &.dark, &.auto { &:hover, &:focus-within { .middleTheme { // Styles... } } } }
@jamesrbrindle
@jamesrbrindle Год назад
Same here, i struggle to keep up with the chicken and egg race that CSS has become.
@protopan7722
@protopan7722 Год назад
nice video man!!!! I will definitely revisit this in the future!!
@vijayarangans9987
@vijayarangans9987 Год назад
I love this quick and easy understandable
@user-kt7li4le8s
@user-kt7li4le8s Год назад
This is actually beautiful!
@WellDressedMuffin
@WellDressedMuffin Год назад
This is clever and shortens the code but to me the original method was far more readable.
@__lasevix_
@__lasevix_ Год назад
Honestly, I prefer the second method. Idk why, it seems cleaner to me
@Mikasks
@Mikasks Год назад
It’s probably because we’re just not used to it. It’s like when you first saw ternary conditional operators, it seems so unintuitive, but then after sometime using it, it’s actually way cleaner and easier to understand.
@AndrewTSq
@AndrewTSq Год назад
i agree, way easier.
@ShadowVipers
@ShadowVipers Год назад
The :is pseudo-selector great and all but I prefer to steer clear of it since condensing all those selectors into one has jacked up it's selector specificity which means it'll override styling below it if it can't match or surpass the specificity. Either that or having to use "!important"... *Shivers* However, that's why I use SCSS which allows me to emulate the :is pseudo-selector (via nested selectors) while not affecting the specificity. Edit: just watched the rest of the video... Where he goes on to discuss it's impact on specificity.
@russl9807
@russl9807 Год назад
With those parenthesis I'm like, deym now its looking like js until he used "where" like fk now its sql!
@traveler_through_life
@traveler_through_life Год назад
Good one, Kevin! Thx
@TheOne-qv3xw
@TheOne-qv3xw Год назад
OMG this is what i am looking for ,, can you make one video no matter how long , but it should covered all selectors with example
@user-yk1lz7gb2t
@user-yk1lz7gb2t Год назад
Omg! Really cool trick man
@Rowadz
@Rowadz Год назад
CSS now reminds me of SQL.
@TimHunold
@TimHunold Год назад
Love it!
@MrGomezJr
@MrGomezJr Год назад
Nice. Thanks man.
@alakhdar100
@alakhdar100 Год назад
Yeah, but how to center a div?
@acidhauss7018
@acidhauss7018 Год назад
Dont like this one at all IMO it is not very readable - personal preference though. Sometimes simplicity over DRY prevails...
@sergnio
@sergnio Год назад
I'm the opposite! I'm excited for more of the scientific method in naming conventions for programming.
@JonSanders
@JonSanders Год назад
Agreed, but I still think it's cool to know it can be done this way.
@acidhauss7018
@acidhauss7018 Год назад
Agree with above but just requires too much thinking to understand - I always try to write code as if the next person is as dumb as me.....
@JonSanders
@JonSanders Год назад
@@acidhauss7018 if you're looking for that dumb guy, I'm right here 🙋🏾‍♂️😂
@user-il9qo4qc4n
@user-il9qo4qc4n Год назад
Totally agree, don't make me have to think
@geebsayshi
@geebsayshi Год назад
Nah I will always be a beginner in CSS. Watching this alone makes my eyes spin
@AlexandraKapit
@AlexandraKapit Год назад
Just Wow!
@NathanHedglin
@NathanHedglin Год назад
Awesome!
@crim-son
@crim-son Год назад
Please how is the support for these selectors? Before i start using them... Really Nice and concise Tutorial Mr Kevin🙌
@dmitry.gashko
@dmitry.gashko Год назад
I'd rather use the first one. Simplified version is too complicated. At least for real projects.
@thieltube390
@thieltube390 Год назад
Yea his solution is shortened, not simplified. Reminds me of those one-liner leetcode solutions that are filled with obscure syntax tricks.
@turolretar
@turolretar Год назад
How is it more complicated if it’s simplified?
@dmitry.gashko
@dmitry.gashko Год назад
@@turolretar just read the replay above
@razor1395
@razor1395 Год назад
Very cool but what's the support like?
@AndrewTSq
@AndrewTSq Год назад
just move the monitor
@ujusomto7964
@ujusomto7964 Год назад
Wow
@curiosdevcookie
@curiosdevcookie Год назад
Wow 😮
@slartidan
@slartidan Год назад
So you turned 6 easy to understand lines into 3 difficult to understand lines? 👏 .is might be helpful in many situations, but in this particular case I prefer the first solution.
@GuitarHope
@GuitarHope Год назад
😁
@Grumble-Puss
@Grumble-Puss Год назад
What's hard to understand? Ends up looking like a SQL select statement. I love it!
@The-LSTV
@The-LSTV Год назад
Why not just .middleTheme:where(:hover,:focus-within){ } Wouldn't just that work here?
@devfreemax3578
@devfreemax3578 Год назад
Good
@dustindustir521
@dustindustir521 Год назад
Yeah but I find the original one simpler, because I don't need to understand these fancy CSS stuff to understand what the selector is doing
@AndrewTSq
@AndrewTSq Год назад
i am not sure I think it was easier to read with is and are.
@danvilela
@danvilela Год назад
Whats in the where specificity that means?
@GGdevelopment
@GGdevelopment Год назад
Nice
@user-il9qo4qc4n
@user-il9qo4qc4n Год назад
This is much harder to read. CSS should be simple even if it's more lines of code.
@luqmarinifalbo
@luqmarinifalbo Год назад
Actually when you find yourself writing and refactoring css code every single day you will discover the value of these shorthands, despite the reading complexity they add to the codes.
@mattshnoop
@mattshnoop Год назад
These are great but sadly pre-Chromium edge does not support it, which is our current target for support at work :/
@sijandahal9637
@sijandahal9637 Год назад
Me writing SASS 💀
@InfinityFnatic
@InfinityFnatic Год назад
And people say tailwind is bad. Lol
@nikulyt3166
@nikulyt3166 Год назад
:is is not supported on old safari
@mhdfr
@mhdfr Год назад
Omg
@rishabhgoel5172
@rishabhgoel5172 Год назад
How are you so good sir? You are using properties that I've never even read of..how did you learn?
@boxoffisa
@boxoffisa Год назад
That one seems to be advanced stuff there. For me the beginner I am learning. Can you teach us how to make websites with dark mode switcher and how I can work with it?
@casper4868
@casper4868 Год назад
When people make a dark mode button/option it's using JavaScript. It's definitely a good JS starting point though, and there are plenty of good examples/tutorials you can find.
@MrMairu555
@MrMairu555 Год назад
Take your pick! ru-vid.comsearch?query=dark%20mode
@webaruhazberles
@webaruhazberles Год назад
I cannot see anything, why the hack is so narrow
@victorbrown3155
@victorbrown3155 Год назад
Just ask GPT3
@mustafashrif
@mustafashrif Год назад
How old are you?
@AyDeeSandra
@AyDeeSandra Год назад
What is the css performance difference between the 2?
@JonSanders
@JonSanders Год назад
🤯🥴
@Chrosam
@Chrosam Год назад
Love you, but sometimes the explicit approach is the better approach
@eduardt333
@eduardt333 Год назад
I still don't understand to this day why won't people use something similar to SASS/SCSS/LESS at least for encapsulating stuff
@narcos1024
@narcos1024 Год назад
I work for a business and also do freelance. If a costumer asks me to work on a project with SASS/SCSS/LESS I immediately assume the code is pure garbage and will not touch it. Personally I think SASS/SCSS/LESS is very hard to read, maintain and the code looks like a complete mess. I want to get work done and not spend must of the time trying to understand what other people did or tried to do.
@aesthet1k_
@aesthet1k_ Год назад
@@narcos1024 I think it's situational. We use SCSS for the nesting and easy namespacing. Occasionally we throw a mixin in there to keep things DRY, but we keep them as simple as possible. We do have some legacy SCSS, however, that's pretty illegible and tries to do things I don't think should be done with styles in the first place. The less logic in a stylesheet the better, imo.
@Shulkerkiste
@Shulkerkiste Год назад
@@narcos1024 I'm using SASS for variables, nesting and sometimes placeholders and I think it is much more readable than CSS. In my option, if SASS "code looks like a complete mess", you cannot write good CSS/SASS code.
@narcos1024
@narcos1024 Год назад
@@aesthet1k_ more libraries, more unnecessary complexity on file structure and more build time. I understand why you would do it, but personally I think it's not worth it. I pass every single project that is not full vanilla css.
@narcos1024
@narcos1024 Год назад
@@Shulkerkiste I think it goes to personal preference. For me SASS, or anything that is not vanilla css, is very hard to read. So it's a big pass on this.
@mbehboodian
@mbehboodian Год назад
Simplifying things does not necessarily mean reducing it.
@irfanshaikh262
@irfanshaikh262 Год назад
Thats SQL within selectors. Brilliant!!!!
@jhona1429
@jhona1429 Год назад
Just use Sass bruh
@KevinPowell
@KevinPowell Год назад
I do, and still use :is() a ton! Sass would simplify that crazy selector, but combine the & with it and you can really hammer things home an extra level, though readability can be questioned if you go too far 😅
@eugenex8892
@eugenex8892 Год назад
Stupid... "is" selector not supported by IE, and if required to make shorter code, everyone just using preprocessors.
@KevinPowell
@KevinPowell Год назад
Other than some edge cases these days, I wouldn't worry about IE. Some companies have to support it still, which I get, but they are few and far between. Even Microsoft has stopped supporting it for their online products, as has Netflix, Google, etc. Now, that doesn't mean not caring at all, but as long as someone on IE has a useable experience (meaning the site isn't completely broken), then, imo, it's fine.
@eugenex8892
@eugenex8892 Год назад
@@KevinPowell 5.8% of internet users still use IE as their main browser. And not bacause awaiting more bugs, from developers. Companies like Netflix and Google cannot support because their products to expensive and big. PS: If you are good, u must help any user, deaf, blind, and even those who have an old computer. If not, then why teach others how not to do it.
@KevinPowell
@KevinPowell Год назад
@@eugenex8892 100% agree that supporting all users is very important! I don't know where that 5.8% number you have comes from though. Last global numbers I've seen are closer to 0.58%. Most users who are on IE aren't there by choice, so making an unusable experience for them is a fail, but I think there are 2 important points to consider. those who are on it make up very specific niches, in general, so for some people, it's *very* important that they support it, but in many circumstances it's a *very* small number... But second point is every user should have a usable experience, like you said, so even if it's only 1 user, you don't want it to be an unusable experience. But that doesn't mean they need the same experience. They need something functional where they can consume the content, but of it's not the same experience as someone on chrome, that's fine. Someone on chrome on desktop and mobile have different experiences as well... Now, that is some nuance I could add to my videos when I do mention newer features, but I really do believe we're past the point of being handcuffed by IE
@skverskk
@skverskk Год назад
I am not a fan of RU-vid ‘shorts’. Worst thing ever
@babayaga6172
@babayaga6172 Год назад
Please make a video on reponsive navbar with nested drop-downa like a e-commerce site have a may levels dee.dropdown. please 🥺
@ed1nh0
@ed1nh0 Год назад
#kevin:is(.awesome)
Далее
A better image reset for your CSS
11:16
Просмотров 107 тыс.
Avoid these 5 beginner CSS mistakes
21:38
Просмотров 71 тыс.
МАЛОЙ И РЕЧКА
00:36
Просмотров 277 тыс.
ОНО СУЩЕСТВУЕТ?? #shorts
00:19
Просмотров 1,3 млн
Top 10 CSS One Liners That Will Blow Your Mind
13:34
Просмотров 911 тыс.
5 simple tips to making responsive layouts the easy way
15:54
CSS Descendant & Child Selectors
6:40
Просмотров 12 тыс.
6 things I wish I knew about CSS when I started
9:09
Просмотров 224 тыс.
Learn Every CSS Selector In 20 Minutes
19:38
Просмотров 438 тыс.
Under the radar CSS features for your CSS reset
11:41
How to write Semantic CSS
8:49
Просмотров 91 тыс.
CSS Transform Is Dead! Use This Instead
7:22
Просмотров 117 тыс.