如何使文本 测试文本
垂直居中?见here
我想让文本和边框底部之间的距离等于文本和边框顶部之间的距离。 `
最佳答案
对于单行文本,使用等于高度
(或四舍五入为偶数)的line-height
。
#a {
display: inline-block;
padding-right: 20px;
padding-left: 15px;
font-family: 'Roboto';
font-size: 12px;
font-weight: bold;
font-stretch: condensed;
COLOR: white;
border-left: 10px solid transparent;
border-bottom: 25px solid;
border-bottom-color: #FF3300;
height: 0;
line-height: 26px;
top: 50%;
}
<span id="a">TEST TEXT</span>
关于html - 如何使文本垂直居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27982686/