我的以下代码有一个包含两列的表。表格的总宽度为800px。我希望两列的宽度相等。因此,我为每个像素设置了400px。但这没有用。我想我需要修改代码才能得到它。应该怎么做?

<html>
    <head>
    <title>OCAAS</title>
    </head>

    <style>
        html { height: 100%; }

        body {
            background: #f5f0ed;
            font: 10px/1 Tahoma, Geneva, Arial, sans-serif;
            font-weight: bold;
            text-aligh: center;
            BACKGROUND-POSITION: center bottom;
        }

        #image{
            width: 300px;
            height: 300px;
            clear: both;
            margin-right: 500px;
            margin-top: -250px;
            background: #green;
        }
        // amend the image
        #image div{
            width: 500px;
            height: 100px;
            float: left;
            line-height: 100px;
            text-align: center;

        }

        #image div img{
            display: inline-block;
            vertical-align: top;
            max-width: 80%;
            max-height: 80%;
        }


    </style>

    <BODY>
        <table width="800px" height="100%" cellpadding="1" cellspacing="1" border="1" align="center">
                <tr>
                    <td align="right" valign="middle" width="400px">
                        <div id="image">
                            <div><img src="cat.jpg" border="0"/></div>
                        </div>
                    </td>
                    <td align="right" valign="middle" width="400px">
                        <div id="wording">
                            <div><p>I AM NEW TO THIS</p></div>
                        </div>
                    </td>
                </tr>
        </table>

        <div id="title">

        </div>
    </body>
</html>

最佳答案

将CSS用于

table{width:100%}
td{width:50%}

09-10 03:00
查看更多