表中心不均匀的行

时间:2013-01-20 08:32:08

标签: html html-table

我有一张有两排的桌子;一个有5个定义,一个有4个。有没有让第二行位于顶行的中心,列不排列?

<table class="productBrowserTableControllerType" id="productBrowserTableControllerType" border="1">
    <tr>
        <td>Standard Solenoid</td>
        <td>"Classic" Solenoid</td>
        <td>Manual Lever</td>
        <td>Palm Button</td>
        <td>Foot Pedal/Treadle</td>
    </tr>
    <tr>
        <td>Cam Roller</td>
        <td>Piston</td>
        <td>Remote Pilot</td>
        <td>Differential Pilot</td>
    </tr>
</table>

2 个答案:

答案 0 :(得分:1)

将第二行包装在另一个表中,并将整个事物放入一个{4}的colspan为5的<td> ......

http://jsfiddle.net/FzUhA/1/

    <tr>
        <td>Standard Solenoid</td>
        <td>"Classic" Solenoid</td>
        <td>Manual Lever</td>
        <td>Palm Button</td>
        <td>Foot Pedal/Treadle</td>
    </tr>
    <tr>
       <td colspan = "5" align="center">
           <table><tr>
           <td>Cam Roller</td>
           <td>Piston</td>
           <td>Remote Pilot</td>
           <td>Differential Pilot</td>
           </tr>
           </table>
         </td>
    </tr>

答案 1 :(得分:0)

这会将第二行移动到中心,它在左侧和右侧具有相等的间距。见fiddle

<table class="productBrowserTableControllerType" id="productBrowserTableControllerType" border="1">
    <tr>
        <td colspan="2">Standard Solenoid</td>
        <td colspan="2">"Classic" Solenoid</td>
        <td colspan="2">Manual Lever</td>
        <td colspan="2">Palm Button</td>
        <td colspan="2">Foot Pedal/Treadle</td>
    </tr>
    <tr>
        <td></td>
        <td colspan="2">Cam Roller</td>
        <td colspan="2">Piston</td>
        <td colspan="2">Remote Pilot</td>
        <td colspan="2">Differential Pilot</td>
        <td></td>
    </tr>
</table>