垂直对齐锚标记中的文本,样式类似于按钮

问题描述 投票:0回答:1

我正在尝试设置一些锚标签的样式,使其看起来与我的按钮完全一样。他们俩都上过普通课:

.xButton {
    border: none;
    padding: 0.5rem 1.5rem;
    display: inline-flex;
    align-items: center;
    line-height: 1.2rem;
    font-size: 1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.5s ease-in-out;
  }

尽管如此,锚标签内文本的垂直对齐方式还是朝向顶部。 In pic attached, the bottom one is the anchor tag, first one is button. This is the case even without icons btw

手动添加

vertical-align: bottom
vertical-align: center
似乎不起作用。有趣的是,当我在公共课上做
all: unset
时,按钮的文本同样垂直对齐到顶部。

html css button flexbox anchor
1个回答
0
投票

你试过了吗

text-align: center
?有点从臀部射击在这里没有看到任何 HTML 如果这没有帮助,我们深表歉意

© www.soinside.com 2019 - 2024. All rights reserved.