Center image

Discussion in 'HTML & Website Design' started by Alan|AzH, Jan 23, 2009.

  1. #1
    Hi,

    I'd like to center an image in a webpage so that no matter the screen or resolution of the viewer, the image will appear dead center.

    I know that <center> </center> tags will center an object on the horizontal, but I want it to center on the vertical too.

    Anyone got a clue how I'd do this?

    Thanks!!
     
    Alan|AzH, Jan 23, 2009 IP
  2. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Center a Website might help. It will be easier to just center the content horizontally as well by just using the <p> element. Some browsers won't render the height property, but going back to tables and the "old" way:
    <table style="width: 100%; height:100%; text-align:center; vertical-align:middle">
    Code (markup):
    will work on most of the browsers. You'll always find a couple of browsers not rendering exactly what you want.
     
    Corey Bryant, Jan 23, 2009 IP
    Alan|AzH likes this.
  3. Alan|AzH

    Alan|AzH Active Member

    Messages:
    298
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Thanks very much for the info.
     
    Alan|AzH, Jan 23, 2009 IP