Center Image in page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    Center Image in page

    How can i render an image in the center of a page.

    I did this: [html]<table width="100%" heigth="100%">
    <tr>
    <td valign="middle" align="center"> <img...... /></td>
    </tr>
    </table>[/html]
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    That works for me. .

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by drhowarddrfine
      That works for me. .
      It does, but without any doctype.
      Gives validation error with the height attribute and height doesn't become 100%.

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Not sure I understand but try this:
        [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
        <html>
        <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <style type="text/css">
        html,body{heigh t:100%;width:10 0%;margin:0}
        table{height:10 0%;width:100%;}
        table tr td {text-align:center}
        </style>
        </head>
        <body>
        <table border=1>
        <tr>
        <td><img src="1.png" alt=""></td>
        </tr>
        </table>

        </body>
        </html>[/HTML]

        Comment

        • hsriat
          Recognized Expert Top Contributor
          • Jan 2008
          • 1653

          #5
          Originally posted by drhowarddrfine
          Not sure I understand but try this:
          [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
          <html>
          <head>
          <title></title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <style type="text/css">
          html,body{heigh t:100%;width:10 0%;margin:0}
          table{height:10 0%;width:100%;}
          table tr td {text-align:center}
          </style>
          </head>
          <body>
          <table border=1>
          <tr>
          <td><img src="1.png" alt=""></td>
          </tr>
          </table>

          </body>
          </html>[/HTML]
          Yeah that works.

          Thanks...

          Comment

          Working...