gpt4 book ai didi

coding-style - 样式 anchor 中的填充与行高

转载 作者:行者123 更新时间:2023-11-28 15:44:33 25 4
gpt4 key购买 nike

在 css 样式元素中何时使用 padding-top/bottom 而不是固定高度和垂直居中与 line-height 时是否有任何规则/建议?

什么是更好/更通用的解决方案(从任何 Angular 来看)?

这个

a {
padding: 0 15px;
height: 40px;
line-height: 40px;
}

或者这个

a { 
padding: 10px 15px;
}

演示 here .

感谢您的体验

最佳答案

当您的文本仅限于一行时,我认为使用它们中的任何一个(填充、行高)都没有太大区别。但是当文本超过一行时,您可能会被迫不使用行高。

关于coding-style - 样式 anchor 中的填充与行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15635302/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com