I use flex for layout purposes, but the browser does not distribute the width evenly between the elements.
.parent {
display: flex;
width: 200px;
}
.btn1 {
flex: 1 1 auto;
}
<div class="parent">
<div class="btn1">
<button align="left" style="width:100%">Ok</button>
</div>
<button align="left" class="btn1">Cancel</button>
<div>
Run codeHide resultNow I want the buttons to share a 50% / 50% container length.
But that is not what is happening. I tried using flex: 1 1 autoand flex: 1 1 0, but without success.
I know that I can use the OK button directly, and this will solve my problem, but in my specific scenario it is important to wrap its div.
Now, as I understand it, flex should be able to evenly distribute the width and that is my goal here.
One more thing though, I noticed that the contents of the button seem to affect the width, and I want to somehow ignore this effect.
Thank!
JSFiddle example:
https://jsfiddle.net/edismutko/cvytLkyp/3/