twitter-bootstrap 删除 Twitter 引导表的第一行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21407988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove the first line of a twitter bootstrap table
提问by Dharma Dude
As you all know when you use Twitter Bootstrap to get a table you get a result like this:

众所周知,当您使用 Twitter Bootstrap 获取表格时,您会得到如下结果:

Would it be possible o remove the very first line of the table, the one above "Abos Girolamo"? Thanks
是否可以删除表格的第一行,即“Abos Girolamo”上方的那一行?谢谢
UPDATE: Here is the code of the table:
更新:这是表的代码:
<table class="table table-no-border">
<tbody>
<tr>
<td>Abos Girolamo</td>
</tr>
<tr>
<td>Aboulker Isabelle</td>
</tr>
<tr>
<td>Adam Adolphe</td>
</tr>
</tbody>
</table>
回答by adrift
.table > tbody > tr:first-child > td {
border: none;
}
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
table {
margin-top: 50px;
}
.table > thead > tr:first-child > td,
.table > tbody > tr:first-child > td {
border: none;
}
<table class="table table-no-border">
<tbody>
<tr>
<td>Abos Girolamo</td>
</tr>
<tr>
<td>Aboulker Isabelle</td>
</tr>
<tr>
<td>Adam Adolphe</td>
</tr>
</tbody>
</table>
回答by Colin Miller
For those who found this question via Google...
对于那些通过谷歌发现这个问题的人......
Bootstrap tables assume you will use a theadin your markup, which is why that top line is present. If you have a mix of tables that include a header and don't include a header, you can use the following CSS to style them correctly.
Bootstrap 表假设您将thead在标记中使用 a ,这就是出现顶行的原因。如果您有包含标题和不包含标题的混合表格,您可以使用以下 CSS 来正确设置它们的样式。
/* Remove the top border when a table is missing the header */
.table > tbody > tr:first-child > td {
border: none;
}
/* Include the border when there's a header */
.table > thead + tbody > tr:first-child > td {
border-top: 1px solid #ddd;
}
回答by emredelioglu
If you want to use jQuery:
如果你想使用 jQuery:
$('#TableID tr:first-child').remove();
<html><body><table id='TableID'>
<tr>Abos Girolamo</tr>
<tr>Aboulker Isabelle</tr>
<tr>Adam Adolphe</tr>
</table></body></html>
回答by Alex
In CSS you would need something like:
在 CSS 中,你需要类似的东西:
.table > tbody > tr:first-child {
display: none;
}

