The new CSS pseudo-classes explained - :is() :where() :has()

The new CSS pseudo-classes explained - :is() :where() :has()

Kevin Powell

1 год назад

135,619 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Miss Hart
Miss Hart - 03.11.2023 13:13

I’m constantly rewatching to see if I can remember the difference bw :is and :has … :has is not forgiving like :is and :where … what else?

Ответить
Shaun
Shaun - 01.11.2023 07:45

Can someone give me a useful example of :where?
It seems redundant, like we can just remove :where

Ответить
Davidov Michael
Davidov Michael - 26.09.2023 21:21

f***in mozilla....

Ответить
Oooga Booga
Oooga Booga - 31.08.2023 18:39

problem is I can't club :has() with :first-of-type(). Which means I can't apply style to the same element after checking if it has a child or not. Its so disappointing tbh

Ответить
Sweet Homes
Sweet Homes - 19.06.2023 03:57

Excellent explanations 😊Thank you

Ответить
Stephen Bolger
Stephen Bolger - 31.05.2023 02:44

Great overview. Really looking forward to using :has.

Ответить
Criztian Jade Tuplano
Criztian Jade Tuplano - 13.05.2023 14:19

I think this is the best use-case of where and is pseudo-classes
```
.example-1:where(.link) :is(:focus, :hover) {
color:red;
}
```

Ответить
Carlos Terrazas
Carlos Terrazas - 08.05.2023 00:17

I do not recommend it. despite being compatible with all browsers it does not have weight and scale. here an example. It is not painting yellow, despite being declared at the end of the style.

.container p{
background-color: green;
}

/* WHERE NO TIENE PESO Y ESCALA. NO RECOMENDABLE */
.container :where(p){
background-color: yellow; // NOT COLOR
}

Ответить
Joel Berglund
Joel Berglund - 28.04.2023 17:21

the has selector will chage my life!! I don't know how many times I've eather repeated something like marigin: 1rem; or given it another selecter eaven when the css has basically been the same css

Ответить
Gary Reid Backing Tracks
Gary Reid Backing Tracks - 18.04.2023 02:30

I watched this three months ago before I knew what any of this was... Now I've finally caught up and am putting these into action. Thanks!

Ответить
Chan SiuMan
Chan SiuMan - 05.04.2023 03:48

very useful ~!

Ответить
Gromp
Gromp - 03.04.2023 23:53

Now just need to wait a few years so we can use it reliably.

Ответить
Chris Ico
Chris Ico - 01.04.2023 19:23

this is a game changer, im foolishly trying to create my own css framework and this has been useful for creating specific components of it

Ответить
P W
P W - 07.03.2023 18:50

Great info - thanks. I wish I'd had those selectors (particularly :has()) years ago.

Ответить
F A
F A - 04.03.2023 17:25

I needed that :has() pseudo-class. I encountered that before where I needed to select a parent based on its child

Ответить
Patrick Nelson
Patrick Nelson - 28.02.2023 02:45

Can't wait until Firefox:has(support)! It's gonna be nice to be able to start using that more often. Anyone have an idea of when they plan on releasing that beyond experimental?

Ответить
Athanasios Agiannidis
Athanasios Agiannidis - 27.02.2023 23:55

Hi Kevin, I am pretty excited with the :has selector. Quick question. Does it mean that we can actually use it to apply different templates based on what we are rendering inside? Do you find it a good idea? Great video man, and keep the camera on, it makes it all personal !

Ответить
Rakesh D'souza
Rakesh D'souza - 25.02.2023 14:28

:has() does not work for me in safari and firefox... chrome and edge it is working... can you confirm

Ответить
Lachee
Lachee - 24.02.2023 18:54

Firefox is really lacking behind. It still doesnt have support for :has

Ответить
Bumbleguppy
Bumbleguppy - 18.02.2023 20:54

How many times over the last 20 years I pulled out my hair trying to find a way to select the parent? :)

Ответить