Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
HTML
<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>


What I have tried:

<image src="images/Noimage.jpg">
i need this image to align center
Posted
Updated 17-Jun-16 21:40pm

1 solution

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:
HTML
<tr align="center">
    <td colspan="2"><image src="images/Noimage.jpg"></td>
</tr>

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
 
Share this answer
 
v6
Comments
Member 12119075 18-Jun-16 3:59am    
thanks its working fine
Sergey Alexandrovich Kryukov 18-Jun-16 4:22am    
No doubt — I usually test what I publish. :-)
You are very welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900