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
  • 84,923
  • 12
  • 110
  • 165
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247

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
  • 266
  • 4
  • 7
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>