본문 바로가기

Web Progreming/HTML

[CSS] Pseudo-Class Selectors Level 4 - :is, :where

출처 : https://web.dev/css-is-and-where/

 

New CSS functional pseudo-class selectors :is() and :where()

These seemingly small additions to CSS selector syntax are going to have a big impact.

web.dev


:is()

/* before */
h1 > b, h2 > b, h3 > b, h4 > b, h5 > b, h6 > b {
  color: hotpink;
}

/* after */
:is(h1,h2,h3,h4,h5,h6) > b {
  color: hotpink;
}

:where()

:is 와 기능적으로는 같은 함수, 단 우선 순위가 :is 가 높고, :where 는 우선 순위가 낮다?

https://developer.mozilla.org/en-US/docs/Web/CSS/:where

 

:where() - CSS: Cascading Style Sheets | MDN

The :where() CSS pseudo-class function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list.

developer.mozilla.org

https://drafts.csswg.org/selectors-4/#zero-matches

 

Selectors Level 4

 

drafts.csswg.org

 

'Web Progreming > HTML' 카테고리의 다른 글

[CSS] 로딩 애니메이션  (0) 2021.07.06
HTTP 응답 상태 코드 - 2  (0) 2019.11.11
HTTP 응답 상태 코드 - 1  (0) 2019.11.08