html a标签中的文字怎么居中对齐<style type="text/css">.btn:hover{font-size:22px;}.btn{color:#000;background:#eaeaea}.a{text-decoration:none;font-size:20px;font-weight:bold;width:222px;height:100px;border:1px solid red}</

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 06:21:54

html a标签中的文字怎么居中对齐<style type="text/css">.btn:hover{font-size:22px;}.btn{color:#000;background:#eaeaea}.a{text-decoration:none;font-size:20px;font-weight:bold;width:222px;height:100px;border:1px solid red}</
html a标签中的文字怎么居中对齐
<style type="text/css">
.btn:hover{font-size:22px;}
.btn{color:#000;background:#eaeaea}
.a{text-decoration:none;font-size:20px;font-weight:bold;width:222px;height:100px;border:1px solid red}
</style>
<a href="javascript:void(0);" class="btn a"><span>系统系统统</span></a>
<a href="javascript:void(0);" class="btn a"><span>系统系统系统系统系统系统系统系统系统系统</span></a>

希望是这样的,因为是动态生成的,所以不能每个写死.

line-height 不行,我是要字在a标签的中间,行高太大两行的间距就太大了,第二行就是会出去!text-align也不行,虽然是居中了,但是不下来,vertical-align用了没什么反应.也没用过,不太熟悉,但是怎么试都不行.

html a标签中的文字怎么居中对齐<style type="text/css">.btn:hover{font-size:22px;}.btn{color:#000;background:#eaeaea}.a{text-decoration:none;font-size:20px;font-weight:bold;width:222px;height:100px;border:1px solid red}</
a标签外层加一个DIV 然后DIV 设置 样式 text-align:center; 这样里面就居中了,这是第一种思路,第二种思路的话,就直接在你的源码上改 .a{text-decoration:none;font-size:20px;font-weight:bold;width:222px;height:100px;border:1px solid red; display:block; text-align:center} 这个就行了,因为A标签不是一个块级元素 所以 要先 display:block
采纳我把.