2017-06-17 88 views
1

嗨我想创建一个表格与我的要求,但不能够得到我的要求,当我尝试。 我的要求如下。HTML表格设计问题

enter image description here

我能得到什么是 enter image description here

是否有可能得到这个使用HTML表格标记。请帮我请

+1

使用colspan rowspan属性。其并不复杂。这里的例子: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_td_rowspan –

+0

无论你有什么现在 –

回答

1

简单,colspanrowspan见下面的例子。

随着colspan您可以合并多行成一个部分

合并单元格

该属性包含一个非负整数,它指示多少列的单元延伸。其默认值为1.高于1000的值将被视为不正确,并将被设置为默认值(1)。

With rowspan您可以将col合并为一个。

rowspan的

该属性包含一个非负整数值,它表示用于多少行的单元延伸。其默认值是1;如果它的值被设置为0,它延伸直到表部(<thead><tbody><tfoot>的端部,即使隐式定义的,该小区所属的值高于65534被限幅至65534

REF :https://developer.mozilla.org/en/docs/Web/HTML/Element/td

table { 
 
    border-spacing: 0; 
 
    text-align: center; 
 
}
<table border="1"> 
 
    <tr> 
 
    <th colspan="11">Northern District</th> 
 
    </tr> 
 
    <tr> 
 
    <td rowspan="2">Alfreds Futterkiste</td> 
 
    <td rowspan="2">Maria Anders</td> 
 
    <td colspan="3">Germany</td> 
 
    <td colspan="3">Maria Anders</td> 
 
    <td colspan="3">Alfreds Futterkiste</td> 
 
    </tr> 
 
    <tr> 
 
    <td>Centro</td> 
 
    <td>Francisco</td> 
 
    <td>Mexico</td> 
 
    <td>Centro</td> 
 
    <td>Francisco</td> 
 
    <td>Mexico</td> 
 
    <td>Centro</td> 
 
    <td>Francisco</td> 
 
    <td>Mexico</td> 
 
    </tr> 
 

 
</table>

+0

感谢队友@丹尼尔。它非常适合我的需求。非常感谢 – arjun

0

<table> 
 
<tr> 
 
\t <th colspan=11>Northern District 
 
<tr> 
 
\t <td rowspan=2>Customers 
 
\t <td rowspan=2>Salesman 
 
\t <td colspan=3>Gas 
 
\t <td colspan=3>Diesel 
 
\t <td colspan=3>Total 
 
<tr> 
 
\t <td>Volume 
 
\t <td>Netback 
 
\t <td>Profit 
 
\t <td>Volume 
 
\t <td>Netback 
 
\t <td>Profit 
 
\t <td>Volume 
 
\t <td>Netback 
 
\t <td>Profit 
 
</table>

+1

谢谢杰克。这有助于 – arjun