@use postcss-media-minmax;
body {
display: grid;
place-items: center;
min-height: 100vh;
font-size: 30px;
transition: font-size 0.3s;
}
@media (480px <= width <= 768px) {
body {
background-color: red;
font-size: 80px;
color: #fff;
}
}
View Compiled
// Just display width of viewport for easy to understand this demo
function getWindowWidth() {
return (document.querySelector("p").textContent = window.innerWidth);
}
getWindowWidth();
window.addEventListener("resize", getWindowWidth);
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.