HTML表格 - 我可以在thead之前增加一个tbody吗? [英] HTML Tables - can I have an additional tbody before the thead?

查看:281
本文介绍了HTML表格 - 我可以在thead之前增加一个tbody吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这张表包含一个< p> ; thead> (由于jquery.tablesorter插件,这是必需的)。我假设如果我在< the> 之上放置另一个< tbody> ,我将能够保持这些元素与其余列一致,但是chrome和firefox都会在< thead>下的< tbody> code>。



示例:

 < table> ; 
< tbody>
< tr>
< td> 1< / td>< td> 1< / td>< td> 1< / td>
< / tr>
< / tbody>
< thead>
< tr>
< th< th> head head< th> head< th>
< / tr>
< / thead>
< tbody>
< tr>
< td> 2< / td>< td> 2< / td>< td> 2< / td>
< / tr>
< tr>
< td> 3< / td>< td> 3< / td>< td> 3< / td>
< / tr>
< tr>
< td> 4< / td>< td> 4< / td>< td> 4< / td>
< / tr>
< / tbody>
< / table>

尽管我明白这一点,但我仍然需要找到一种方法让这些元素与特定< thead> 中的多行像这样: -

 < table> 

< thead>

< tr> < TD→1< / TD> < TD→1< / TD> < / TR>

< tr> < TD> HEAD< / TD> < TD> HEAD< / TD> < / TR>

< / thead>

< / table>


I need add to some elements on top of a table in line with the columns of the said table.

This table contains a <thead> (which is required due to jquery.tablesorter plugin). I assumed that if I put another <tbody> on top of the <thead> I would be able to keep these elements in line with the rest of the columns, but both chrome and firefox render every <tbody> below the <thead>.

Example:

<table>
    <tbody>
        <tr>
            <td>1</td><td>1</td><td>1</td>
        </tr>
    </tbody>
    <thead>
        <tr>
            <th>head</th><th>head</th><th>head</th>
        </tr>
    </thead>        
    <tbody>
        <tr>
            <td>2</td><td>2</td><td>2</td>
        </tr>
        <tr>
            <td>3</td><td>3</td><td>3</td>
        </tr>
        <tr>
            <td>4</td><td>4</td><td>4</td>
        </tr>
    </tbody>
</table>

Although I understand this, I still need to find a way to have these elements stay in line with specific columns.

解决方案

You can use multiple rows in <thead> like this:-

<table>

   <thead>

     <tr> <td>1</td> <td>1</td> </tr>

     <tr> <td>head</td> <td>head</td> </tr>

   </thead>

</table>

这篇关于HTML表格 - 我可以在thead之前增加一个tbody吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆