I am trying to use horizontal flex elements inside a button, but they don't stretch vertically to the button height. Why?
Here is the snippet with button
markup (does not stretch):
.container {
width: 200px;
height: 100px;
}
.btn {
width: 100%;
height: 100%;
padding: 0;
background: transparent;
border: 1px solid yellow;
display: flex;
align-items: stretch;
}
.content {
flex: 1;
color: white;
}
.red { background: red; }
.green { background: green; }
.blue { background: blue; }
<div class="container">
<button class="btn">
<div class="content red">Ho</div>
<div class="content green">Ho</div>
<div class="content blue">Ho</div>
</button>
</div>
Here is the snippet with div
markup (does stretch):
.container {
width: 200px;
height: 100px;
}
.btn {
width: 100%;
height: 100%;
padding: 0;
background: transparent;
border: 1px solid yellow;
display: flex;
align-items: stretch;
}
.content {
flex: 1;
color: white;
}
.red { background: red; }
.green { background: green; }
.blue { background: blue; }
<div class="container">
<div class="btn">
<div class="content red">Ho</div>
<div class="content green">Ho</div>
<div class="content blue">Ho</div>
</div>
</div>
I also tried height: 100%
oir self-align: stretch
in .content
class, without success.