如何在自动高度计算中包括下降高度?

时间:2016-04-06 18:33:55

标签: html css

对于行高:1,字体上的下降符将溢出自动高度。

以下是一个示例:



body{
  line-height: 1;
  font-size: 50px;
}
div{
  overflow: auto;
}

<html>

<body>
  <div>
    <a href="">gqpy</a>
  </div
</body>

</html>
&#13;
&#13;
&#13;

我可以使用How to calculate descender height in javascript?来计算高度并手动添加填充,但如果可能的话,我想使用纯CSS解决方案。

1 个答案:

答案 0 :(得分:0)

你的意思是什么?

http://codepen.io/anon/pen/EKoYgL

weak

删除ul { padding-left: 0} li { list-style-type: none; } a {font-size: 70px; } 样式上的overflow: auto;,您的链接上不会有滚动条。