Re: Centering image on page?

Discussion in 'HTML' started by Richard, Jun 25, 2003.

  1. Richard

    Richard Guest

    "Lorne Cameron" <> wrote in message
    news:3ef9b95b$...
    > I'm redesigning the gallery on my site so that when a thumnail is
    > clicked, an HTML page is generated containing the image centered on the
    > page. I have it working just using a few <BR>s and <CENTER> tags, but
    > I'd like it to be truely centered both horizontally and vertically. So
    > I tried having a table with WIDTH and HEIGHT at 100%, with
    > ALIGN="center" and VALIGN="middle". It works fine when the image is
    > small enough to fit in the window, but when it has to be resized it
    > leads to problems. Here's what I have so far (border is inplace just
    > now so that I can see what is happening - the extra height/width added
    > by the border is negligable and is not the cause of the problem):
    >


    FWIW, I'd lose the document.write altogether for the table. Not needed.
    <table><tr align="center" valign="middle"><td align="center"
    valign="middle">
    <img src="name.jpg" height="x00" width="x00">
    </td></tr></table>

    Where x could theoretically be the same and the image would adjust
    accordingly.
    So that if x was not the image size, it would still be sized in the same 4x3
    format.
    For thumbnails, 200x200 seems to work out just fine.
     
    Richard, Jun 25, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry Camel

    Centering an image with text

    Jerry Camel, Sep 23, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    725
    John Timney \(ASP.NET MVP\)
    Sep 23, 2005
  2. mr_vocab
    Replies:
    4
    Views:
    858
    mr_vocab
    May 24, 2004
  3. Samuël van Laere

    Image centering

    Samuël van Laere, Dec 5, 2004, in forum: HTML
    Replies:
    4
    Views:
    683
    David Dorward
    Dec 5, 2004
  4. Steve Greenaway

    Something about image centering

    Steve Greenaway, Dec 5, 2004, in forum: HTML
    Replies:
    3
    Views:
    508
    David Dorward
    Dec 5, 2004
  5. fantababy

    Centering image without <center>

    fantababy, Apr 21, 2006, in forum: HTML
    Replies:
    13
    Views:
    888
    Jonathan N. Little
    Apr 21, 2006
  6. Jeff
    Replies:
    1
    Views:
    686
    Alexey Smirnov
    May 15, 2007
  7. Murdoc

    Image Centering Problem

    Murdoc, Sep 13, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    191
    Murdoc
    Sep 14, 2004
  8. cjl
    Replies:
    1
    Views:
    129
    Dominic Tocci
    Jun 30, 2005
Loading...