我的表格 CSS 代码覆盖了 Bootstrap 日期选择器。它看起来一点也不像日历。我该如何解决这个问题?
我尝试使用 css ":not"不幸的是没有用。 我不知道还能尝试什么。 我还尝试将它们更改为类,并尝试哪些效果不佳。
有没有办法只忽略此元素的 css 文件或使 bootstrap css !important?
请检查带有运行代码的演示。 谢谢。
表格的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 演示的分支:https://codepen.io/kshetline/pen/mdbjyQr
您已经有了一个围绕您的表格的 table-align
类,因此所有必要的就是为 CSS 规则添加前缀,这些规则只适用于您的表格 。表格对齐
。例如:
.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)
内容。
关于html - Bootstrap 日期选择器样式被 CSS 表格样式覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57934222/