gpt4 book ai didi

html - 按钮的文本垂直对齐

转载 作者:技术小花猫 更新时间:2023-10-29 12:17:27 24 4
gpt4 key购买 nike

我遇到了棘手的问题。我想在按钮内垂直对齐我的文本

<button id="rock" onClick="choose(1)">Rock</button>

这是我的 CSS

button {
font-size: 22px;
border: 2px solid #87231C;
border-radius: 100px;
width: 100px;
height: 100px;
color: #FF5A51;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
button:active {
font-size: 22px;
border: 2px solid red;
border-radius: 100px;
width: 100px;
height: 100px;
}

你可以在这里查看http://jsfiddle.net/kA8pp/ .我想把文字放在底部。 非常感谢!

编辑:我无法很好地解释它所以这是它的图片:)

enter image description here

最佳答案

您可以使用 line-height 来实现您的目标。

button {
font-size: 22px;
border: 2px solid #87231C;
border-radius: 100px;
width: 100px;
height: 100px;
color: #FF5A51;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
line-height: 150px;
overflow: visible;
}

http://jsfiddle.net/kA8pp/2/

关于html - 按钮的文本垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15487408/

24 4 0
文章推荐: html - rails : Converting a text field's linebreaks into
文章推荐: javascript - 提交后清除我的表单输入
文章推荐: html - 在 HTML 中隐藏文本?
文章推荐: html - 如果有打开的 `if` 标签,Razor `}` 不会注册关闭 ``?