0

Context

  • Was interested in using clamp() to regulate the width of textual
    content between certain values.
  • When inside of flex item it doesn't bump the neighboring
    content down to next row when the minimum width is reached. The
    content overlaps.
  • See demo in codepen below.

Demo: https://codepen.io/gabrimo/pen/LYxeMvR


Container and Flex Items

.container {
    display: flex;
    flex-wrap: row;
}
.flex-items {
    flex: 0 1 50%;
}

Three Tests - paragraphs in flex items

Only p3 below bumps the neighboring flex item to next row when container width is narrowed.

.p1 {
    width: clamp( 20em, 100% , 40em );
}
.p1 {
    width: max( 20em, min( 100%, 40em ));
}
.p1 {
    min-width: 20em; / or width: 20em;
}

The spec doesn't give much detail on how clamp works. Why does clamp behave this way in the flex scheme?

gabrimo
  • 53
  • 6
  • only p3 has min-width. that is preventing the flex-shrink:0 from working like it's doing for the other. the first ones are simply overflowing – Temani Afif Apr 10 '21 at 23:11
  • add `min-width:0` to `item` and the 3 will behave the same: https://stackoverflow.com/q/36247140/8620333 – Temani Afif Apr 10 '21 at 23:13

0 Answers0