将文本置于按钮中心CSS
问题描述:
我正在玩CSS和按钮,我希望文本历史记录位于按钮的中心,但它出现在单元格的顶部。我怎样才能将它垂直放入中间?将文本置于按钮中心CSS
CSS
a.button {
background: url(button.png) no-repeat 0 0;
width: 150px;
height: 62px;
display: block;
}
HTML
<td align="center" valign="middle" >
<a href="history.htm" class="button"/><b>HISTORY</b></a>
</td>
答
如果它只有一行文字,比我平时使用line-height
= height
a.button {
background: green;
width: 150px;
height: 62px;
display: block;
line-height: 62px;
text-align: center;
}
<a href="history.htm" class="button"/><b>HISTORY</b></a>
非常感谢。这工作完美。 – RGriffiths 2014-09-23 11:05:10