设置了文字了小于12px时,会存在设置了line-height的不生效的问题,主要是由于基线的问题,这篇文章解释的很清楚,有兴趣的可以看下https://blog.csdn.net/q121516340/article/details/51483439

方法1:

使用CSS3 scale属性,设置时将所有的值设置大一倍,然后缩小一倍

        height: 32px;
            line-height: 32px;
            font-size: 20px;
            text-align: center;
            transform: scale(0.5);

 方法2:直接用定位,只是比较傻的方法

相关文章:

  • 2021-04-17
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案