Dev Helpers
← Back

Auto-fit definition pairs

Auto-fit definition pairs with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
    gap: 0.8rem;
  }
</style>
<dl class="demo">
  <div>
    <dt>Width</dt>
    <dd>210 mm</dd>
  </div>
  <div>
    <dt>Height</dt>
    <dd>297 mm</dd>
  </div>
</dl>