如何垂直对齐文本? [英] How to align text vertically?
本文介绍了如何垂直对齐文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用CSS垂直对齐文本的最简单方法是这里?
What is the easiest way to align the text vertically here with CSS ?
<ul>
<li>Hello</li>
<li>Bye Bye</li>
<li>Ciao</li>
</ul>
li {
border: 1px solid black;
width: 100px;
height: 50px;
margin-bottom: 20px;
text-align: center;
}
推荐答案
的文本,您可以将 line-height
设置为与 height
相同的值。这适用于任何元素。
If you have just one line of text, you can set the line-height
to the same value as the height
. This works for any element.
这篇关于如何垂直对齐文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文