Bootstrap 日期选择器样式被 CSS table 样式覆盖

Boostrap datepicker style being overriden by CSS table styling

我的 CSS table 代码覆盖了 bootstrap datepicker.It 看起来一点也不像日历。我该如何解决这个问题?

我尝试使用 css ":not" 不幸的是没有用。 我不知道还能尝试什么。 我也尝试将它们更改为 类 并尝试哪个也不起作用。

是否只忽略此元素的 css 文件或使 bootstrap css !important?

请检查带有 运行 代码的演示。 谢谢。

Codepen Demo

CSS代码table

/*Table*/
body{
  background-color:black;
  color:white;
}

table:not(.form-control) {
    font-family: "Open Sans", sans-serif;
    border: 1px solid salmon;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 100%;
    table-layout: fixed;
}

table caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
}

table tr:not(.form-control) {
    background-color: #0B0C10;
    border: 1px solid #0B0C10;
    padding: .35em;
}

table th:not(.datepicker),
table td:not(.datepicker) {
    padding: .625em;
    text-align: center;
}

table th:not(.datepicker-days) {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
}

@media screen and (max-width: 600px) {
    table {
        border: 0;
    }

    table caption {
        font-size: 1.3em;
    }

    table thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    table tr {
        border-bottom: 3px solid salmon;
        display: block;
        margin-bottom: .625em;
    }

    table td {
        border-bottom: 1px solid salmon;
        display: block;
        font-size: .8em;
        text-align: right;
    }

    table td::before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
    }

    table td:last-child {
        border-bottom: 0;
    }
}

Codepen Demo

请查看您的 Codepen 演示的分支:https://codepen.io/kshetline/pen/mdbjyQr

你已经有一个 class table-align 包裹在你的 table 周围,所以所需要的只是在 CSS 规则前加上要应用的规则只给你的 table 和 .table-align。例如:

.table-align table th,
.table-align table td {
    padding: .625em;
    text-align: center;
}

.table-align table th {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
}

而且我还删除了所有 :not(.datepicker) 内容。