使用valign =" top"将图像发送到td的底部属性

时间:2015-02-14 23:52:55

标签: html

我在尝试将图像发送到td的底部时遇到了很多问题。问题是 td需要具有valign="top"属性。

<html height="100%">
    <table  height="100%" width="100%">
        <tr>
            <td height="10%" valign="top" style="background-color: black">  </td>
        </tr>       
        <tr>
            <td height="80%" valign="top" style="background-color: grey">
            Website content..
            <img  style="position:absolute; right:10px; bottom: 10px " height="45" width="45" src="http://rsm.imap.cc/-images/rss.jpg"></img>   
            </td>
        </tr>
        <tr>
            <td height="10%" valign="top" style="background-color: black">  </td>
        </tr>               
    </table>
</html>

我最接近的是将图像发送到网站的底部,但这不是我想要做的,图像应保留在灰色背景上。 (第二个td)

1 个答案:

答案 0 :(得分:1)

试试这个:将position: relative;放在<td>上,然后position: absolute;放在<img>上,并给它bottom: 0;

然后,您还需要在padding-bottom: <height-of-image>px;上设置<td>,以防止图片覆盖文字。