CSS表样式覆盖了Boostrap datepicker样式

时间:2019-09-14 09:35:46

标签: html css html-table bootstrap-datepicker

我的table的CSS代码正在覆盖引导日期选择器,它看起来不像日历。我该如何解决?

我尝试使用css“:not”不幸的是没有用。 我不知道还能尝试什么。 我还尝试将它们更改为类,然后尝试效果不佳的

总有没有要忽略此元素的css文件或使bootstrap css!important吗?

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

Codepen Demo

表格的CSS代码

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

1 个答案:

答案 0 :(得分:0)

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

您已经有一个table-align类,该类被包装在表中,因此所需要做的只是给CSS规则加上前缀,这些CSS规则仅适用于带有.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)内容。