PDA

View Full Version : image alignment using HTML?



web88js
22 Apr 2006, 07:00 PM
hello everyone:

I have a question rearding image alignment. I want to display the picutre at the center of the web page

I did two experiments.
a) first I try to use <p> tag to align the image it won't work
<p style = "text-align: center">
<!-- using link lead to picture display -->
<a href = "c:/local_sites/table_exer1/images/jeff.jpg" style = "text-align: center"> Jeff's Picture</a>
</p>

b) I tried to use table to align the image it won't work as well :(

<table align = center border = 10>
<tr>

<td>
<p style = "text-align: center">
<a href = "c:/local_sites/table_exer1/images/jeff.jpg"> Jeff's Picture</a>
</p>
<td>
</tr>
</table>

both a) and b) display image defalut to the left

Please give me some advises on how to make the image display at the center of the page.
I just want to use plain HTML code, no CSS. Thanks!

Jeff
4-22-06

Wickham
23 Apr 2006, 01:40 AM
Well, your second example b) does centralise in my IE6 and Firefox. However, I think you could improve it.
Either
<table align="center" border = 10>
<tr>
<td>
<a href = "c:/local_sites/table_exer1/images/jeff.jpg"> Jeff's
Picture</a>
</td>
</tr>
</table>

or
<center>
<table border = 10>
<tr>
<td>
<a href = "c:/local_sites/table_exer1/images/jeff.jpg"> Jeff's
Picture</a>
</td>
</tr>
</table>
</center>

Note a correction: </td> not <td> after the </p> and you don't need to put in image in <p> tags, only when you have text and even then not always necessary. You might need a <p> tag if you had the image first then <p align="center"> tag then text underneath it. <p style = "text-align: center"> is actually the css way of doing the same thing.