I am trying to use CSS variables in media query and it does not work.
:root {
--mobile-breakpoint: 642px;
}
@media (max-width: var(--mobile-breakpoint)) {
As you can read other answers, still not possible to do so.
Someone mentioned custom environmental variables (similar to custom css variables env()
instead of var()
), and the principle is sound, though there are still 2 major issues: