【问题标题】:emojis are causing change in line height表情符号导致行高发生变化
【发布时间】:2021-12-30 09:40:03
【问题描述】:

<p>Alternatively, you can use percentages, which
   will be calculated with respect to the width of the generated box's
   containing block. &#128517;Therefore, assuming the container's width
   is greater than the image's height, margin: -50% 0 should be enough.
   Hide code snippet
</p>

如何避免在插入表情符号时改变行高?

【问题讨论】:

标签: html css emoji


【解决方案1】:

你可以像这样设置一个固定的line-height

p {
  line-height: 20px !important;
}
<p>Alternatively, you can use percentages, which
   will be calculated with respect to the width of the generated box's
   containing block. &#128517;Therefore, assuming the container's width
   is greater than the image's height, margin: -50% 0 should be enough.
   Hide code snippet
</p>

【讨论】:

    【解决方案2】:

    将css属性line-height设置为1.2em可以将p标签设置为默认高度

        p {
          line-height: 1.2em;  
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-17
      • 2022-01-13
      • 1970-01-01
      • 2010-09-30
      • 1970-01-01
      • 2023-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多