0

If I have 3 items in a flex box all set to flex: 1 how would I make one of them 1/2 to 1/4th the size of the others?

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

div > * {
   background-color: lightblue;
   padding: 4px;
   flex: 1;
   border: 1px solid gray;
}

.smaller {
   flex: .5 1 auto;
}
<div class="div">
  <div>1</div>
  <div>2</div>
  <div class="smaller">3</div>
</div>

This seems to work here but it's not working in my project.

Is there a simpler example? Setting flex to anything other than "1" doesn't seem to work. I've read 5 articles on this and I don't know how those flex values work.

1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231

1 Answers1

1

Trying flex: .5 1 0 should work. That should size it the way you want.

IPSDSILVA
  • 1,667
  • 9
  • 27