简体   繁体   English

为什么在显示弹性容器的高度内没有计算填充

[英]Why is padding not calculated inside the height of the display flex container

 .wrap { display: flex; flex-flow: column; }.row { display: flex; flex-flow: row wrap; background: yellow; } group label { padding: 1em; background: red; }
 <div class='wrap'> <h2> Header </h2> <div class='row'> <group> <label> Label </label> </group> </div> </div>

Why is this padding not inside the calculated height of the container.为什么这个填充不在容器的计算高度内。

Label's are display inline block by default.默认情况下,标签是显示内联块。 Set it to default block将其设置为默认块

 .wrap { display: flex; flex-flow: column; }.row { display: flex; flex-flow: row wrap; background: yellow; } group label { padding: 1em; background: red; display:block }
 <div class='wrap'> <h2> Header </h2> <div class='row'> <group> <label> Label </label> </group> </div> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM