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

标签 css

是否可以对两个或多个内联 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/

相关文章:

jquery - Bootstrap 打开多个模式问题

javascript - CKEditor inline - 添加内容时对齐的底部不会移动。

html - 相对于输入字段的小帮助文本

css - 我无法让我的动画在 h1 元素上运行

html - 放大模糊整个屏幕

javascript - Chrome 开发工具中的奇怪 console.log 行为?

javascript - Angular 2 在 [ngStyle] 中设置背景图像和颜色

css - 将半 SASS、半 CSS 改造为 SASS 的简单方法?

jquery - 如何隐藏html中的行

css - 将 Bootstrap 容器包裹在单列中,100% 高度