Open this example in the interactive library
Source code
<style>
.demo {
container-type: inline-size;
}
.tile {
font-size: clamp(1rem, 6cqi, 2rem);
}
</style>
<div class="demo"><span class="tile">Container units</span></div>
Scale a label with its container width with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo {
container-type: inline-size;
}
.tile {
font-size: clamp(1rem, 6cqi, 2rem);
}
</style>
<div class="demo"><span class="tile">Container units</span></div>