Today I Learned - Rocky Kev

TIL of using the "is" property

POSTED ON:

TAGS:

The :is() 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. This is useful for writing large selectors in a more compact form.

The MDN

header p:hover,
main p:hover,
footer p:hover
{
color: red;
cursor: pointer;
}

/* The above is equivalent to the following */
:is(header, main, footer) p:hover {
color: red;
cursor: pointer;
}

via r/steve8708's subreddit post


Related TILs

Tagged:

TIL the alternate keyword

If 'alternate' appears along with the stylesheet keyword, the linked file is an alternative stylesheet. It won’t be applied to the document, but it will be ready for when we need it.

TIL Logical Properties

For that sweet sweet Internationalization you want to avoid directional words like 'left', 'right', 'top', and 'bottom'.

TIL Using pseudo-classes in your querySelector!

let notTuna = document.querySelectorAll('.sandwich:not(.tuna)')