HTML表格单元格背景图片对齐

5
我需要将表格单元格的背景图像对齐方式设置为:垂直顶部 - 水平右侧。但是它显示的格式为:垂直中心 - 水平右侧。请参考此页面:http://www.chemfluence.org.in/monetarist/index_copy.php。这是我的代码:
<td width="178" rowspan="3" valign="top" 
align="right" background="images/left.jpg" 
style="background-repeat:no-repeat;background-position:right;">
</td>

如果我使用 background-position:top;,它会在水平方向上居中对齐,请告诉我需要更正哪个部分。

请查看以下内容以设置背景。http://www.dustindiaz.com/css-shorthand/ - Hary
2个回答

12

像这样使用内联CSS

<td width="178" rowspan="3" valign="top" 
align="right" background="images/left.jpg" 
style="background-repeat:background-position: right top;">
</td>

你已经应用了这个吗?我已经检查过了。 - Ghost Answer

6

这在IE9(兼容视图和正常模式)、Firefox 17和Chrome 23中有效:

<table>
    <tr>
        <td style="background-image:url(untitled.png); background-position:right 0px; background-repeat:no-repeat;">
            Hello World
        </td>
    </tr>
</table>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接