0

div{
  display:flex;
  border:1px solid red;
}

div button{
  flex:0 0 1;
  border:1px solid gray;
}
<div>
   <button>Button one</button>
   <button>Button two</button>
</div>
Asons
  • 81,773
  • 12
  • 93
  • 144
3gwebtrain
  • 14,377
  • 24
  • 102
  • 222

3 Answers3

1

Try this

div{
  display:flex;
  border:1px solid red;
}

div button{
  flex: 1;
  border:1px solid gray;
}
<div>
   <button>Button one</button>
   <button>Button two</button>
</div>
Atanu Mallick
  • 196
  • 3
  • 6
0

First, you have a typo "dispaly:flex;". :)
Second, just put flex-grow: 1; on the buttons.
Example code:

div{
  display:flex;
  border:1px solid red;
}

div button{
  flex-grow: 1;
  border:1px solid gray;
}

Hope it helps.

  • Nope. If the button text in one button is larger then the button will be larger than 50%. `flex-basis: 50%` is correct. – Jason Moore Nov 27 '18 at 15:45
0

Should be this.

div {
  display: flex;
  border: 1px solid red;
}

div button {
  flex: 0 0 50%;
  border: 1px solid gray;
}
<div>
   <button>Button one</button>
   <button>Button two</button>
</div>