【问题标题】:Vertical centering inside an anchor tag [duplicate]锚标签内的垂直居中[重复]
【发布时间】:2017-06-06 16:13:06
【问题描述】:

如何让文本“不要点击我”垂直居中:

<a href="#" style="background-color:red; display:inline-block; height:100px;">Don’t click me</a>

https://jsfiddle.net/r1t99rfz/

【问题讨论】:

标签: html tags anchor center


【解决方案1】:
.anchor {
  background-color:red;
  display:inline-block;
  line-height: 100px;
  height: 100px;
}

line-height 设置为与height 相同的值

【讨论】:

    猜你喜欢
    • 2011-10-06
    • 1970-01-01
    • 2020-08-07
    • 2020-03-02
    • 2017-08-16
    • 2016-07-29
    • 2020-08-12
    • 2012-12-28
    • 2017-05-25
    相关资源
    最近更新 更多