如何在表格单元格的div内对齐由两个跨距生成的垂直文本。我尝试了文本对齐,显示的许多组合,但是没有任何效果。我有这个HTML段
<table>
<tr>
<td>
<div class="container">
<span>This is span-sentence-1</span>
<span>This is span-sentence-2</span>
</div>
</td>
</tr>
</table>
和输出是
This is span-sentence-1 This is span-sentence-2
而我想像这样渲染
This is span-sentence-1
This is span-sentence-2
您可以使用以下内容:
.container {
width: 100%;
line-height: 50px;
border: 1px solid black;
/*height: 50px; Remove height*/
}
.container span{
display: block;/*Set display to block*/
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句