gpt4 book ai didi

css - 是否可以对两个或多个内联 block 使用不同的行高?

转载 作者:太空宇宙 更新时间:2023-11-03 19:36:02 24 4
gpt4 key购买 nike

是否可以对两个或多个内联 block 使用不同的行高?示例:

.block{
width: 300px;
}

.text-1 {
font-size: 30px;
line-height: 30px
}

.text-2 {
font-size: 20px;
line-height: 15px
}
<div class="block">
<span class="text-1">Here some text here some text</span>
<span class="text-2">other text other text other text</span>
</div>

这是我想要得到的: enter image description here

最佳答案

.text-1 {
line-height: 1.5em;
}

.text-2 {
line-height: 1em;
font-size: 0.8em;
color: #555;
}

div{
width: 400px;
font-size: 2.5em;
font-color: #000;
font-family: sans-serif;
}
<div>
<span class="text-1">Here some text here some text</span>
<span class="text-2">other text other text other text other text other text</span>
</div>

关于css - 是否可以对两个或多个内联 block 使用不同的行高?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45866699/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com