gpt4 book ai didi

html - 如何阻止文本在表格中垂直居中?

转载 作者:行者123 更新时间:2023-12-03 09:26:41 25 4
gpt4 key购买 nike

这是制作表格的 html 代码:

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="profile">
<img src="http://www.teleread.com/wpcontent/uploads/2009/05/image18.png" />
</div>
</td>
<td>Hello</td>
</tr>
</table>

这是CSS:

.profile img {
width: 120px;
height: 125px;
float: left;
margin-right: 4px;
margin-top: 4px;
margin-bottom: 4px;
border: 1px #cc1212 solid;
clear: both;
}

这是在 jsfiddle 上运行的代码:

http://jsfiddle.net/Yeqnn/

问题:“Hello”一词在右列垂直居中

我该如何解决这个问题?顺便说一句,图像必须位于表格中并向左浮动才能配合我当前的主题...任何想法,如果是这样,请留下答案。

最佳答案

简单地说vertical-align: top;在您的<td>上元素。

Demo

关于html - 如何阻止文本在表格中垂直居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19557283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com