1

1行(すべての列のヘッダー)で表を作成し、ヘッダーの下に行と列(ヘッダーの後の通常の表)を作成したいと思います。私は今のところこのようなものを持っています:

<table style="margin: auto;" border="1">
    <colgroup>
        <col align="left">
        <col align="right">
        <col align="right">
        <col align="right">
        <col align="right">
    <thead style="background: #F0F0F0" colspan="6" scope="colgroup">
        <tr>
            <th>header
    <thead style="background: #F0F0F0">
        <tr>
            <th>a 
            <th> a 
            <th> a 
            <th> a <br> b 
            <th> a 
            <th> a
</table>

しかし、現在、「ヘッダー」は最初の列のみにあり、すべての列に拡大したいと考えています。

4

4 に答える 4

3

ではなくタグで使用colspanする必要がありますththead

<thead>
     <tr>
         <th colspan="6">Head</th>
     </tr>
</thead>

デモ

于 2013-09-21T10:59:31.367 に答える
2

これを試してください、うまくいきます。

コードにいくつかの変更を加えただけです。

<table style="margin: auto; border:1">
        <colgroup>
            <col align="left">
            <col align="right">
            <col align="right">
            <col align="right">
            <col align="right">
            <col align="right">
            </colgroup>
            <thead style="background: #F0F0F0"  scope="colgroup">
                <tr>
                    <th colspan="6">
                        header
                    </th>
                </tr>
            </thead>
            <thead style="background: #F0F0F0">
                <tr>
                    <th>
                        a
                    </th>
                    <th>
                        a
                    </th>
                    <th>
                        a
                    </th>
                    <th>
                        a
                        <br>
                        b
                    </th>
                    <th>
                        a
                    </th>
                    <th>
                        a
                    </th>
                </tr>
            </thead>
            <tbody style="background: #FFFFFF">
            </tbody>
         </table>
于 2013-09-21T11:10:17.250 に答える
0

このコードを試してください

<TABLE style=\margin: auto;\ border=1>
<COLGROUP><COL align=left><COL align=right><COL align=right><COL align=right><COL align=right>
    <THEAD style=\background: #F0F0F0 \ colspan=\6\ scope=\colgroup\><TR> <TH colspan="6">header
    <THEAD style=\background: #F0F0F0 \><TR> <TH>a <TH> a <TH> a <TH> a <br> b <TH> a <TH> a
    <TBODY style=\background: #FFFFFF\>
    </TABLE>
于 2013-09-21T10:58:40.053 に答える