【问题标题】:Change height of single char inside a text in html/css在 html/css 中更改文本中单个字符的高度
【发布时间】:2020-10-16 07:31:35
【问题描述】:

我正在使用 Unicode 符号 (U+25C0) 在按钮上制作“左箭头”,但符号本身向下移动了一点。我找不到居中的方法,我尝试了边距、填充和行高,但没有成功。

它是这样的:

还有简单的代码:

h2 {
  font-family: Oswald;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Oswald">

<h2>
  <span style="font-size: 70%">&#9664</span>
  &nbsp;Return
</h2>

如果有人可以帮助我,我只需要将符号垂直居中 :)

【问题讨论】:

  • h2 {display: flex;对齐项目:中心;}

标签: html css layout alignment centering


【解决方案1】:

您可以将其添加到您的 CSS 以使其垂直居中:

h2 {
  display: flex;
  align-items: center;
}

如果您也想水平对齐,请使用justify-content: center;

【讨论】:

    【解决方案2】:

    看起来像因为 style="font-size: 70%"。当我删除它时,它看起来很好。尝试将其移除或将其移动到 span 元素之外的其他位置

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-05
      • 2016-12-18
      • 2021-07-16
      • 1970-01-01
      • 2016-06-05
      • 2012-11-13
      • 1970-01-01
      相关资源
      最近更新 更多