我试着让下面的蓝色盒子填满按钮的整个高度,但它似乎不起作用。为什么height: 100%不适用于.el元素?
button {
background: red;
height: 55px;
display: flex;
align-items: center;
}
.el {
display: block;
background: blue;
height: 100%;
}<button>
<span class="el">
Content
</span>
Other
</button>
输出(Chrome 76):

其他浏览器似乎显示了预期的结果
边缘:

Firefox:

发布于 2019-09-19 12:32:30
试一试
.el {
display: block;
background: blue;
height: inherit;
}https://stackoverflow.com/questions/58011010
复制相似问题