Search code examples
htmlimagecenter

HTML: How do I center a banner in a table?


I have not used HTML in a long time (pre-CSS). Basically I am a complete noob. I pray that I can get some useful information.

There are threads that cover this question and I have employed all of them without success, so I am assuming it is something in my style formatting, but I cannot pin point the issue. This is where I am right now.

{<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html14/frameset.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>A Web Site</title>
        <style type="text/css">
        body {
            border-style:ridge;
            border-color:inherit;
            border-width:thin;
            background-color: beige;
            margin-left: 4px;
            margin-right: 4px;
            margin-top:3px;
            margin-bottom:3px;
            padding: inherit;
            font-family: Calibri;
            height:auto;
            width:auto;

            </style>

</head>
<body>
    <form id="form1" runat="server">
                <div id="Home Page">
                <table>
                   <tr><td align="center">
                      <img src="Some/pic.jpg">
                   </td></tr>

                </table>
                </div>


   </form>
</body>
</html>}

Solution

  • You need a curly brace.

    //...
    height: auto;
    width: auto;
    }