想使用A 标签内的文字垂直居中时,必须设置a标签的display为 block才可以实现。同时设置高度和宽度。示例代码如下:

<style type="text/css">
.div{
    width: 100px;
    height: 60px;
background-color: green;
}
.demoa{
display: block; 
    width: 100px;
    height: 60px;
    line-height: 60px;
    text-align: center;
}
</style>

<div class="div">
<a class="demoa" href="https://lebang2020.cn" target ="_blank">乐帮网首页</a>
</div>