关于重复问题的更新:它不是相同的问题,因为我无法设置包含div的高度。如何对齐div内的span元素?
如何在div内水平和垂直对齐span元素。
该div是resposive元素,因此它可能需要几个大小。 跨度并没有设置高度也不宽度
<div class="the-div">
<span class="the-span" >span here</span>
</div>
我尝试:
.the-span{top: 50%; text-align: center}
我不想用JS这一点。
捕获:
居中对齐,你是什么意思? –
您是否尝试在div class'the-div'中添加'text-align:center'? – Lee
是的,我需要中心的跨度里面,水平和垂直 – JPashs