html - 相互竞争的 CSS 样式表

标签 html css twitter-bootstrap

我正在尝试删除特定表格上的边框:

<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/

相关文章:

javascript - 使用 ajax 重新加载特定 div 后,Bootstrap 工具提示/弹出窗口停止工作

javascript - 动态对象 html - 在 Canvas 上通过函数绘制的对象之间进行交替,并使用范围/ slider 来更改模式

html - CSS floating div 在缩小屏幕尺寸时落到屏幕底部

html - 是否可以使用 CDN 仅对 div 应用 Bootstrap ?

html - 在 <section> 中将图像居中,按钮位于下方

html - 我们如何调整垂直线的大小以匹配框架大小

jquery - 在 bootstrap 下拉列表中选择新元素不会清除之前的选择

php - 使用 SimpleHTMLDOM 在 PHP 中解析 HTML iFrame SRC

javascript - 我在 fullpost.php 中有一个评论表单,而插入表单在 sql.php 中,如何获取评论表的 post_id ?

html - 如何删除表单验证中的验证气泡消息