category | created | tags | title |
---|---|---|---|
Tip |
2021-03-23 |
CSS |
Combine styles with the :is pseudo-class selector |
The :is
pseudo-class selector applies the styles for any element that matches a selector listed in the arguments.
Rather than writing separate selectors:
header a:hover,
nav a:hover,
footer a:hover {
text-decoration: underline;
}
We can combine them into a single one as following:
:is(header, nav, footer) a:hover {
text-decoration: underline;
}