2011-09-15 12 views
0

私は単純なテーブルを作成しようとしているが、私は連続したテーブル行にcolspansを設定した後、第二列のcolspan属性が上書きされます。ネストされたCOLSPAN

<table class="d-week"> 
<caption> 
<h4>table</h4> 
</caption> 
<thead> 
    <tr> 
     <th class="col_first"></th> 
     <th colspan="1">1st week</th> 
     <th colspan="1">2nd week</th> 
     <th colspan="1">3rd week</th> 
    </tr> 
    <tr> 
     <th></th> 
     <th colspan="3">prop1</th> 
     <th colspan="3">prop2</th> 
     <th colspan="3">prop3</th> 
    </tr> 
</thead> 
<tbody> 
    <tr> 
     <td></td> 
     <td>col1</td> 
     <td>col1</td> 
     <td>col1</td> 
     <td>col2</td> 
     <td>col2</td> 
     <td>col2</td> 
     <td>col3</td> 
     <td>col3</td> 
     <td>col3</td> 
    </tr> 
</tbody> 
</table> 

しかし、ここでは、テーブル本体細胞であります(たとえ最初のヘッダーの行からcolspanプロパティを削除しても)2番目のヘッダーの代わりに1番目のヘッダーの行に揃えられます。誰か助けてくれますか?

EDIT:2つ目のヘッダーの行に3つ以上ある場合はどうなりますか?th http://jsbin.com/icetom/3

+0

Calあなたはまた、あなたが期待するものの簡単な例を挙げます。 – Nivas

答えて

2

私は多分あなただけのヘッダーの最初の行にはcolspan = 3を設定する必要があり、私はよく理解していればdon'tknow、しかし。あなたはあなたが持っているセルの最大数に相対的なカルパンについて考えることができます。あなたの例では10です。行の列をより多くの列にまたがるようにするには、それに基づいて番号を選択します。

2
<table> 
<caption> 
<h4>table</h4> 
</caption> 
<thead> 
    <tr> 
     <th></th> 
     <th colspan="3">1st week</th> 
     <th colspan="3">2nd week</th> 
     <th colspan="3">3rd week</th> 
    </tr> 
    <tr> 
     <th></th> 
     <th colspan="3">prop1</th> 
     <th colspan="3">prop2</th> 
     <th colspan="3">prop3</th> 
    </tr> 
</thead> 
<tbody> 
    <tr> 
     <td></td> 
     <td>col1</td> 
     <td>col1</td> 
     <td>col1</td> 
     <td>col2</td> 
     <td>col2</td> 
     <td>col2</td> 
     <td>col3</td> 
     <td>col3</td> 
     <td>col3</td> 
    </tr> 
</tbody> 
</table> 

ここに住ん例:http://jsbin.com/ateraw/

+0

あなたの返信をありがとうが、もし私の2番目のヘッダー行に '' 6があれば、 'colspan =" 2 "'を最初のヘッダー行に設定したいのですが、動作しません。= S –

+0

@ Jerec:次に* that *コードを投稿して、何が起こっているかを見ることができます。 –

+0

私は理解しているので、トップレベルのcolspanを取得するためにスパンされている親の数にまたがるセルの数を掛けなければなりません –