0
我想让这些div内的图像和文字都垂直居中。我得到img
与top: 0; bottom: 0; margin: auto;
一起工作。然后,我试图通过将line-height
和height
设置为与容器相同的高度来垂直对齐文本,但是它不能很好地居中,它已经关闭了一定量。不能垂直对齐div内的文字
我该如何得到这个工作?
<div class="border" style="border:1px solid red; width:100%; height:70px; position:relative;">
<div class="border" style=" border:1px solid red; float:left; width:25%; height:100%; position:relative;"><!--contenedor facebook-->
<img style="width:32px; height:32px; position:absolute; top:0; bottom:0; margin:auto;" src="">
\t <a href="tel:+34646611421"><span style=" position:absolute; left:33px; line-height:70px; height:70px; font-family:Oswald, sans-serif; font-size:24px;">646611421</span></a>
</div>
<div class="border" style=" border:1px solid red; float:left; width:25%; height:100%; position:relative;"><!--contenedor mail-->
<img style="width:32px; height:32px; position:absolute; top:0; bottom:0; margin:auto;" src="">
\t <span><a href="#" style="line-height:70px; height:70px; position:absolute; left:33px;">Mail Us</a></span>
</div>
</div>
看起来垂直居中,你在哪里看到过的像素? – BogdanC