brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: :where() in css gives a selector zero specificity so it is easy to override

Css
~/tips/tip-css-where-zero-specificity

:where(.prose) a { color: #0645ad; text-decoration: underline; }

Wraps a selector so it adds no specificity, which keeps default styles easy to override.

Default styles that are hard to override cause more trouble than they save.

:where(.prose) a { color: #0645ad; text-decoration: underline; }
.button-link { color: inherit; }

:where() accepts a selector list like :is() but always counts as specificity zero. Here the link style inside .prose has the weight of a plain a selector, so a single class such as .button-link wins without !important or a longer selector. It is well suited to base styles in a reset or a theme. Only the selectors inside the brackets lose their weight, anything written outside them still counts.

Further reading: MDN: :where()

More Css tips CSS Overview in Chrome DevTools audits the colors and fonts of a page .notice:empty { .toast { article { counter-reset: h2; } .toolbar { All Css tips (66) All topics

Link