I'm building a responsive layout, referencing my variable in media queries, like this:
.item {
--width: calc(50% - 10px);
width: var(--width);
padding-top: calc(var(--width) * 0.75);
}
@media(min-width: 920px) {
.item {
--width: calc(33.3333% - 10px);
}
}
@media(min-width: 1280px) {
.item {
--width: calc(25% - 10px);
}
}
It works in Google Chrome. Is there better way to do this assuming I want to stick to vanilla CSS? Are there any potential pitfalls with this solution?