0

我有一张桌子

<tr>Page header goes here</>
<tr valign="top">
        <td align="center" height="100%" valign="top">
            <center>
                <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1">
                    <tbody>
                        <tr height="29%">
                            <td height="29%">
                                 // to display the below tr in center of page
                            </td>
                        </tr>
                        <tr height="31%">
                            <td bgcolor="FFFFFF" height="31%" align="center" valign="top">
                                <table width="40%" height="31%" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tbody>
                                        <tr>
                                            <td width="16">
                                                <img src="@Href("~/Content/themes/base/images/top_lef.gif")" width="16" height="100%" />
                                            </td>
                                            <td height="16" style="background-image: url('@Url.Content("~/Content/themes/base/images/top_mid.gif")')">
                                                <img src="@Href("~/Content/themes/base/images/top_mid.gif")" width="16" height="100%" />
                                            </td>
                                            <td width="24">
                                                <img src="@Href("~/Content/themes/base/images/top_rig.gif")" width="24" height="100%" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="16" style="background-image: url('@Url.Content("~/Content/themes/base/images/cen_lef.gif")')">
                                                <img src="@Href("~/Content/themes/base/images/cen_lef.gif")" width="16" height="100%" />
                                            </td>
                                            <td bgcolor="#F7F8FB" valign="top">
                                                <div style="height: 30px;">
                                                </div>
                                                @using (Html.BeginForm())
                                                {
                        //login details username and password
                                                }
                                            </td>
                                            <td width="24" style="background-image:url('@Url.Content("~/Content/themes/base/images/cen_rig.gif")')">
                                                <img src="@Href("~/Content/themes/base/images/cen_rig.gif")" width="24" height="100%" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="16" height="16">
                                                <img src="@Href("~/Content/themes/base/images/bot_lef.gif")" width="16" height="16" />
                                            </td>
                                            <td height="16" style="background-image: url('@Url.Content("~/Content/themes/base/images/bot_mid.gif")')">
                                                <img src="@Href("~/Content/themes/base/images/bot_mid.gif")" width="16" height="16" />
                                            </td>
                                            <td width="24" height="16">
                                                <img src="@Href("~/Content/themes/base/images/bot_rig.gif")" width="24" height="16" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr height="39%">
                            <td height="39%">
                                 // to display the above tr in center of page
                            </td>
                        </tr>
                    </tbody>
                </table>
            </center>
        </td>
    </tr>
    <tr>Page footer goes here</>

我在登录控件所在的主体上方和下方添加了一个 tr 和 td,分别为 20% 和 31%

@using (Html.BeginForm())
{
}

但在 IE 中,登录控件显示在中心,但在 chrome 中,登录显示在页面标题之后。似乎没有考虑 29% 的高度。我尝试添加
,但两种浏览器的结果都不一样。

我一直在寻找一种更简洁的方法来解决这个问题。如果有人可以帮我解决这个问题。

4

1 回答 1

0

请不要将表格用于新的站点布局。那里有很多更好的方法。请看一下div。

于 2013-09-26T08:28:29.147 回答