HTML表格单元背景图像对齐

时间:2021-07-22 22:22:22

I need the background image of a table cell to be aligned as

我需要将表单元格的背景图像对齐为

Top in vertical side - Right in Horizontal

顶部垂直于水平方向。

But it is displaying as,

但是它显示为,

Center in Vertical side ; Right in Horizontal

垂直中心;在水平

Take a look at this page: http://www.chemfluence.org.in/monetarist/index_copy.php

看看这个页面:http://www.chemfluence.org.in/monetarist/index_copy.php

Here is my code,

这是我的代码,

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

if i use background-position:Top; it is center aligned Horizontally please let me know which should be corrected.

如果我使用背景位置:最高;它是水平对齐的,请告诉我哪一个需要更正。

2 个解决方案

#1


9  

use like this your inline css

像这样使用你的内联css

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

#2


5  

This works in IE9 (Compatibility View and Normal Mode), Firefox 17, and Chrome 23:

这适用于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>

#1


9  

use like this your inline css

像这样使用你的内联css

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

#2


5  

This works in IE9 (Compatibility View and Normal Mode), Firefox 17, and Chrome 23:

这适用于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>