HTML 表格单元格背景图像对齐
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14251349/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML Table cell background image alignment
提问by logan
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.
如果我使用背景位置:顶部;它是水平居中对齐,请让我知道哪个应该更正。
回答by Ghost Answer
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>
回答by Anthony Tietjen
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>