表格式

时间:2014-06-01 17:05:09

标签: html css

我有下表的结构。我尝试添加空的tds div,以获得图像中的以下格式,但无法正确。任何想法将不胜感激。

<table border="0" cellpadding="1" cellspacing="0" width="100%">
    <tR>    
    <td align="center"> <strong>ONE</strong></td> 

    <td align="center"><strong> TWO</strong></td>

    <td align="center"><strong>THREE</strong></td>
    </tR>

    <tr>
        <td align="left">Quiz NAME</td>
        <td align="right">FINAL</td>
        <td align="right">USS </td>
        <td align="right">PA </td>
        <td align="right">INTL </td>        
        <td align="right"> FINAL</td>
        <td align="right"> USS</td>
        <td align="right"> PA </td>
        <td align="right"> INTL </td>
        <td align="right"> FINAL</td>
        <td align="right"> USS</td>
        <td align="right"> PA</td>
        <td align="right">INTL</td>     
    </tr>
    <TR>DATA HERE</TR>

   </table>

enter image description here

4 个答案:

答案 0 :(得分:3)

这是有效的代码:

<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tR>    
<td colspan="4" align="center"> <strong>ONE</strong></td> 

<td colspan="4" align="center"><strong> TWO</strong></td>

<td colspan="4" align="center"><strong>THREE</strong></td>
</tR>

<tr>

    <td align="center"align="center">FINAL</td>
    <td align="center" >USS </td>
    <td align="center"align="center">PA </td>
    <td align="center">INTL </td>        

    <td align="center"> FINAL</td>
    <td align="center"> USS</td>
    <td align="center"align="center"> PA </td>
    <td align="center"> INTL </td>

    <td align="center"> FINAL</td>
    <td align="center"> USS</td>
    <td align="center"> PA</td>
    <td align="center">INTL</td>     
</tr>
<TR>DATA HERE</TR>

答案 1 :(得分:1)

使用&nbsp;

示例:

<td align="right">&nbsp;</td>   

答案 2 :(得分:1)

查看此页面:

http://css-tricks.com/complete-guide-table-element/

colspan和rowspan正是您要搜索的内容:)

答案 3 :(得分:1)

您需要colspan来合并表中的列。更新您的表结构,如下所示。

<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tR>    
<td colspan="4" align="center"> <strong>ONE</strong></td> 

<td colspan="4" align="center"><strong> TWO</strong></td>

<td colspan="4" align="center"><strong>THREE</strong></td>
</tR>

<tr>
    <td align="left">Quiz NAME</td>
    <td align="right">FINAL</td>
    <td align="right">USS </td>
    <td align="right">PA </td>
    <td align="right">INTL </td>        
    <td align="right"> FINAL</td>
    <td align="right"> USS</td>
    <td align="right"> PA </td>
    <td align="right"> INTL </td>
    <td align="right"> FINAL</td>
    <td align="right"> USS</td>
    <td align="right"> PA</td>
    <td align="right">INTL</td>     
</tr>
<TR><td colspan="12">DATA HERE</td></TR>