css - 多行块的百分比填充
问题描述
我可以根据多行文本的高度设置填充吗?例如,我对每条新线的需求padding-top
越来越div.p
少。
.modal{
width: 200px;
height: 200px;
border: 1px solid gray;
font-size: 16px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-evenly;
float: left;
}
.p{
position: relative;
}
.p:before{
content: '';
display: block;
position: relative;
width: 100%;
height: calc((120px - 100%) / 5); /*not working*/
}
<div class="modal">
<div class="text">
<div class="h"><b>Header</b></div>
<div class="p">Multiline text. Multiline text.</div>
</div>
<button>Button</button>
</div>
更多示例:https ://jsfiddle.net/1n4bdtea/ (我想要文本和标题之间的填充〜10x 1 行和〜5px 4 行)
解决方案
推荐阅读
- react-hook-form - 使用 useController 创建可重用组件可以提供任何价值
- spring-boot - 如何将 swagger 与 Spring Cloud 功能集成
- javascript - 从不同 x 轴刻度值开始的多条折线图
- python-3.x - 如何在以下情况下打印出变量?
- wordpress - 如何撤消对特色图像的批量删除?
- mysql - MYSQL 如何找到创建帐户时发生的事件计数(两个时间戳)?(对于许多用户)
- c# - 必须声明标量变量@Id
- .net - 如何限制rabbitmq的队列在发送消息到其他通道之前等待ack
- python - 我如何一次请求所有这些 API?
- python - 在 CSV 中将 3 行合并为 1 行