我有这个布局:
我的 CSS:
body {
background: #e2eaed;
}
a {
text-decoration: none;
color: #fff;
font-size: 30px;
height: 62px;
line-height: 62px;
/* vertical-align: middle is not works */
background: #8dc73f;
width: 132px;
padding: 0 25px;
font-size: 16px;
text-align: center;
font-weight: bold;
margin-left: 4px;
display: block;
float: left;
}
当按钮有 1 行文本时,我的代码运行良好。但是当按钮有 2 行文本时,如上图所示。代码文本的高度很大,因为我使用了该line-height
属性。我已经尝试过vertical-align
,但它不起作用。
请参阅jsfiddle。