我正在尝试删除特定表格上的边框:
<table class="teacher">
<tr>
<td>row 1</td>
<td>col 1</td>
<td>col 2</td>
</tr>
<tr>
<td>row 2</td>
<td>col 1</td>
<td>col 2</td>
</tr>
</table>
你可以看到我的 fiddle here
我认为 bootstrap.css
与我的 site.css
竞争,但我不确定如何摆脱边界?
这是我的老师(来自 site.css
)样式:
.teacher {
text-align: left;
padding: 0;
}
.teacher table {
border: none !important;
border-collapse:collapse !important;
}
.teacher .contentLabel {
width: 45%;
}
.teacher input {
width: 10px;
padding: 0px;
}
.teacher textarea {
width: 225px;
padding: 0px;
}
我的包:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/site.css",
"~/Content/bootstrap.css",
"~/Content/bootstrap-theme.css",
"~/Content/bootstrap-duallistbox.css",
"~/Content/jquery.dataTables.css"));
我认为这是导致 Bootstrap 出现此问题的原因:
.table {
width: 100%;
margin-bottom: 20px;
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #ddd;
}
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > td {
border-top: 0;
}
.table > tbody + tbody {
border-top: 2px solid #ddd;
}
.table .table {
background-color: #fff;
}
最佳答案
注释掉 <td>
的边框在第 94 行。
td {
color: #000;
/* border: 1px solid #7c7c7b; */
padding: .3em 1em;
text-align: left;
}
如果您曾经使用 <thead>
,请牢记额外的 CSS 片段和 <th>
表格元素:
第 103 行:
th {
color: #7c7c7b;
font-weight: 700;
font-size: large;
text-align: center;
/* border: 1px solid #7c7c7b; */
padding: .3em 1em;
}
第 112 行:
th.th2 {
color: #7c7c7b;
font-weight: 300;
font-size: large;
text-align: center;
/* border: 1px solid #7c7c7b; */
padding: .3em 1em;
}
关于html - 相互竞争的 CSS 样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21840363/