Dev Helpers
← Back

Prevent a flex item from shrinking

Prevent a flex item from shrinking with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo {
    display: flex;
    width: 12rem;
  }
  .demo > :first-child {
    width: 8rem;
    flex-shrink: 0;
  }
</style>
<div class="demo">
  <span class="tile">One</span><span class="tile">Two</span
  ><span class="tile">Three</span>
</div>