样式锚点内的居中文字

缺口

我正在使用“ a”标签并将其样式设置为稍大一些,但我似乎无法使文本在中间对齐。我尝试添加填充,但这只会使其变得更大。现在,文字在左上角,但我想让它居中,有什么想法吗?

<a href="#">text</a>
a {
    width: 196px;
    height: 64px;
    background-color: blue;
    border: 0px none;
    font-size: 20px;
    color:white;
}
朝夕
a {
    width: 196px;
    height: 64px;
    background-color: blue;
    border: 0px none;
    font-size: 20px;
    color:white;
    display:inline-block; /* if more items are in line */
    line-height:64px; /* if one line of text is in question */
    text-align:center;

}

http://jsfiddle.net/K4q6H/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章