0

我有一个母版页,其中它们是一个有 3 行的表。第一行是页眉,第二行是正文,第三行是页脚。标题行再次包含一个具有 1 行和 3 列的表。第一个 col 宽度固定为 238 px,而最后一个 col 固定为 7% 宽度。并且中间的col占据了所有剩余的空间。

第二行还包含 3 列,第 1 列 = 20%,第 3 列 = 20%,中间占据其余部分。

问题:-我必须以内部内容从相同水平位置开始的方式调整两个表格的中间列。

这是具有所需样式的 html 示例

<html xmlns="http://www.w3.org/1999/xhtml">

.style1 { 宽度:100%; }

<div align="center">
    <table align="center" class="style1">
        <tr>
            <td>
                <div align="center">
                    <table align="center" class="style1">
                        <tr>
                            <td width="238px">
                                Logo width = 238px</td>
                            <td align="center">
                                <div style="background-color: #008000">
                                    start line should aling with the below start line</div>
                            </td>
                            <td width="7%">
                                cart width =7%</td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div align="center">
                    <table align="center" class="style1">
                        <tr>
                            <td width="20%">
                                &nbsp;</td>
                            <td align="center">
                                start line should aling with the top</td>
                            <td width="20%">
                                &nbsp;</td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
</div>

我需要 aling 'start line'(在带有 bgcolor = green 的 div 和 td 中),以便它们从同一个位置开始。

4

2 回答 2

0

第二个表格中第一个 <td> 的宽度也应该是 238px。

<td width="238px">&nbsp;</td>

编辑:您是否在 <style> 标签中定义了 style1?如果不是,第二个 <tbody> 将减小宽度。

<style type="text/css">.style1 { width: 100%; } </style>
于 2013-09-28T07:39:58.910 回答
0
<div align="center">
    <table align="center" class="style1">
        <tr>
            <td>
                <div align="center">
                    <table align="center" class="style1">
                        <tr>
                            <td width="238px">
                                Logo width = 238px</td>
                            <td style="padding-left:50px; background-color: #008000">
                                    start line should aling with the below start line
                            </td>
                            <td width="7%">
                                cart width =7%</td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div align="center">
                    <table align="center" class="style1">
                        <tr>
                            <td width="238px">
                                &nbsp;</td>
                            <td style="padding-left:50px;">
                                start line should aling with the top</td>
                            <td width="20%">
                                &nbsp;</td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
</div>

使用填充而不是align="center"

于 2013-09-28T07:44:13.323 回答