[英]Vertical align an image inside a table to the bottom
A typical css alignment problem: 典型的CSS对齐问题:
<table style="width:100px"> <!-- Not actually necessary; just makes the example text shorter -->
<tr>
<td style="padding:0;">
<div style="height:100%; width:100%; background-color:#abc; position:relative;">
test of really long content that causes the height of the cell to increase dynamically
</div>
</td>
<td>
<div>text</div>
<div ></div>
<img style="vertical-align: bottom;" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/1118727_100000298033362_1412277170_q.jpg"/>
</td>
</tr>
</table>
http://jsfiddle.net/R5TAY/ http://jsfiddle.net/R5TAY/
How would I make the image always appear on the bottom of the table, and the text to stay in the middle? 我将如何使图像始终显示在表格底部,而文本仍保留在中间?
Thanks 谢谢
Based on your example, you could use positioning to achieve what you want: 根据您的示例,您可以使用定位来实现所需的目标:
td {
position:relative;
}
img {
position:absolute;
bottom:0;
}
Set valign to bottom 将valign设置为底部
<td valign="bottom">
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.