2017-06-17 89 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