0

Sorry to ask such a basic question about flexbox, but I have a 2 row, 2 col grid and want to make the first col in each row the same width, such that the smileys occur immediately after the longer YEET (and the smileys are at the same point in the x-axis, if you will):

.row {
  display: flex;
  flex-direction: row;
}

.col {
  display: flex;
  flex-direction: column;
}
<div class='row'>
  <div class='col a'>YEET</div>
  <div class='col b'>:)</div>
</div>

<div class='row'>
  <div class='col a'>YEET STICK</div>
  <div class='col b'>:)</div>
</div>

I know I can assign .a a static fixed width like so:

.a {
  flex: 0 0 105px;
}

But I want the width of the longer text box to set the width of both text boxes (rather than some arbitrary cutoff like 105px).

I believe it's possible to achieve this goal with flex-grow, but am not sure just how. Any pointers others can offer would be greatly appreciated!

duhaime
  • 25,611
  • 17
  • 169
  • 224

0 Answers0