https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_container_queries
.container {
container: article / inline-size;
}
h2 {
font-size: 7cqw;
}
@container article(width<150px) {
h2 {
color: #ffc600;
}
}
h2.fit {
font-family: 'Operator Mono', 'monospace';
--minFontSize: 10px;
--letters: 12
font-size: max(
var(--minFontSize),
calc(calc(100 / var(--letters)) *1.5cqw)
);
}
The container query length units are:
cqw
: 1% of a query container's widthcqh
: 1% of a query container's heightcqi
: 1% of a query container's inline sizecqb
: 1% of a query container's block sizecqmin
: The smaller value of eithercqi
orcqb
cqmax
: The larger value of eithercqi
orcqb