【问题标题】:HTML table: second row showing beside the first one, not belowHTML 表格:第二行显示在第一行旁边,而不是下方
【发布时间】:2014-04-03 13:57:31
【问题描述】:

为什么第二行显示在第一行内而不是像其他行一样在下面?代码如下:

http://jsfiddle.net/jdelva/9MfGf/4/

<body>
<table id="mitabla" >
    <caption>
        <span class="titulo">Tabla de posiciones campeonato nacional</span>
    </caption>
    <tr class="encabezado">
        <th rowspan="2" colspan="2"> #</th>
        <th rowspan="2" colspan="2"> /\</th>
        <th rowspan="2" colspan="8"> Equipo</th>
        <th rowspan="2" colspan="2"> PJ</th>
        <th rowspan="2" colspan="2"> PG</th>
        <th rowspan="2" colspan="2"> PE</th>
        <th rowspan="2" colspan="2"> PP</th>
        <th rowspan="2" colspan="2"> GF</th>
        <th rowspan="2" colspan="2"> GC</th>
        <th rowspan="2" colspan="2"> DG</th>
        <th rowspan="2" colspan="2"> Pt</th>
    </tr>
    <tr class="equipo">
        <td>1</td>
    </tr>
    <tr class="equipo">
        <td>2</td>
    </tr>
    <tr class="equipo">
        <td>3</td>
    </tr>



</table>
</body>

PS:抱歉我懒得翻译西班牙语,但我的意思是,这些词不是问题

【问题讨论】:

    标签: html html-table row


    【解决方案1】:

    尝试在第一行之后插入空行

    <body>
    <table id="mitabla" >
    <caption>
        <span class="titulo">Tabla de posiciones campeonato nacional</span>
    </caption>
    <tr class="encabezado">
        <th rowspan="2" colspan="2"> #</th>
        <th rowspan="2" colspan="2"> /\</th>
        <th rowspan="2" colspan="8"> Equipo</th>
        <th rowspan="2" colspan="2"> PJ</th>
        <th rowspan="2" colspan="2"> PG</th>
        <th rowspan="2" colspan="2"> PE</th>
        <th rowspan="2" colspan="2"> PP</th>
        <th rowspan="2" colspan="2"> GF</th>
        <th rowspan="2" colspan="2"> GC</th>
        <th rowspan="2" colspan="2"> DG</th>
        <th rowspan="2" colspan="2"> Pt</th>
    </tr>
    <tr></tr>
    <tr class="equipo">
        <td>1</td>
    </tr>
    <tr class="equipo">
        <td>2</td>
    </tr>
    <tr class="equipo">
        <td>3</td>
    </tr>
    

    【讨论】:

    • 您的空行不符合 W3C。
    • 问题是我为什么要插入一个空行?
    【解决方案2】:

    删除您的rowspan="2",您的第二行就在正确的位置。

    【讨论】:

    • 你能告诉我为什么 rowspan="2" 影响第二行吗?也许我对它的工作原理有一个不好的认识
    猜你喜欢
    • 2015-02-06
    • 1970-01-01
    • 1970-01-01
    • 2021-11-08
    • 2012-04-30
    • 2013-01-13
    • 2019-07-07
    • 2022-08-13
    • 1970-01-01
    相关资源
    最近更新 更多