Dev Helpers
← Back

Scale a label with its container width

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

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>