如何制作我的< tr>图像标签中心 [英] How do I make my <tr> image tag center

查看:73
本文介绍了如何制作我的< tr>图像标签中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<table cellspacing='1' cellpadding='1' style='border:0px solid lightblue'>

<tr><td  align='center'>Status :IN Coverage</td></tr>
<tr><td>Asset Name/Ship Image :</td><td>MV Hercules</td></tr>
<tr align="center"> <image src="images/Noimage.jpg"> </tr>
<tr><td>Type</td><td>:Tug</td></tr>
<tr><td>MMSI no</td><td>:417222418</td></tr>
<tr><td>IMO no</td><td>:9771119</td></tr>
<tr><td>TrackerID</td><td>:01154528SKY839D</td></tr>
<tr><td>Latitude/Longitude</td><td>:6?57'12'' N/79?51'17'' E</td></tr>
<tr><td>Speed (knots)</td><td>:0</td></tr>
<tr><td>Heading (?)</td><td>:86</td></tr>
<tr><td>MessageReceived TimeUTC</td><td>:18/Jun/2016 00:42</td></tr>

</table>





我尝试过:



< image src =images / Noima ge.jpg>

我需要这个图像来对齐中心



What I have tried:

<image src="images/Noimage.jpg">

i need this image to align center

推荐答案

如果没有 td ,则不能使用 tr 。添加 td ,您将拥有该行。下一个问题是:它只会产生一个 td 对应于表格最左边的单元格,因为其他行有两个单元格。因此,它会将图像置于最左侧的列中心,但可能您希望将其相对于表格居中。



解决方案是:添加属性 colspan =2,这将使单元格跨越表格宽度。您将使用图像对行进行以下修改:

You cannot use tr without td. Add td and you will have the row in place. Next problem is: it would make just one td corresponding to the leftmost cell of your table, because your other rows have two cells. As a result, it would center the image in the leftmost column, but probably you want to center it relative to the table.

The solution is: add the attribute colspan="2", which will make a cell spanning over the table width. You will get the following modification of your row with the image:
<tr align="center">
    <td colspan="2"><image src="images/Noimage.jpg"></td>
</tr>



现在,你的另一个问题是:你尝试使用HTML控制样式细节。这是错的。您必须使用CSS,以获得稳健性,灵活性和可维护性。只有CSS。您应该允许自己使用的唯一与样式相关的HTML属性应该是CSS class ,但即使它的使用也应该最小化。



-SA


Now, your other problem is: you try to control the style detail using HTML. This is wrong. You have to use CSS, for robustness, flexibility and maintainability. Only CSS. The only style-related HTML attribute you should allow yourself to use should be CSS class, but even its use should be minimized.

—SA


这篇关于如何制作我的&lt; tr&gt;图像标签中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆