[英]How to correctly vertical align image+text inside table cell
I need to vertical-align:top
both 'Some text' and 'Other text'. 我需要
vertical-align:top
'有些文字'和'其他文字'。 The following is not working for me, only the second cell is aligned correctly. 以下内容对我不起作用,只有第二个单元格正确对齐。 I don't understand what the problem is.
我不明白问题是什么。
<style>
td {
vertical-align:top;
}
</style>
<table>
<tr>
<td><img src="icon.png"/> Some text </td>
<td> Other text </td>
</tr>
</table>
Rather than using: 而不是使用:
td {
vertical-align: top;
}
Use: 使用:
td {
vertical-align: baseline;
}
td img {
vertical-align: top;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.