Results 1 to 2 of 2

Thread: image alignment using HTML?

  1. #1
    Join Date
    Aug 2004
    Posts
    34

    image alignment using HTML?

    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
    Last edited by web88js; 22 Apr 2006 at 06:02 PM. Reason: change notification type

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •