DataTable:如何隐藏表头?

7 html css datatables jquery-datatables

我有2个使用DataTable的表:

  • 顶部:完全匹配
  • 下:相关

这就是他们现在的样子。

在此处输入图片说明

如您所见,无需在第二个表上显示表头。我要隐藏它。

我试过在CSS上使用它:

由于类= inventory_related

.inventory_related table thead {

        display:none;

    }
Run Code Online (Sandbox Code Playgroud)

我也试图脱掉整个:

       <thead class="thin-border-bottom ">

            <th>Catalog # </th>
            <th>Description</th>
            <th>Available Vials</th>

        </thead>
Run Code Online (Sandbox Code Playgroud)

这也不起作用。

有人对我如何隐藏第二张表头有任何建议吗?

谢谢。

小智 11

就我而言,设置

.inventory_related thead {    
    display:none;   
}
Run Code Online (Sandbox Code Playgroud)

弄乱了列宽,而

.inventory_related thead {    
    visibility: collapse;   
}
Run Code Online (Sandbox Code Playgroud)

似乎正在工作。


小智 5

<table>
  <thead style='display:none;'>
    <th>header 1</th>
    <th>header 2</th>
  </thead>
  <tbody>
    <td>row value 1</td>
    <td>row value 2</td>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)


Tan*_*ani 0

如果类<table>inventory_related那么写下面的css

.inventory_related thead {    
    display:none;   
}
Run Code Online (Sandbox Code Playgroud)