【发布时间】:2020-01-30 18:32:13
【问题描述】:
我在带有悬停选项的表内有引导日期选择器。进入日期选择器时,显示月份和日期的前两行被表格中的 css 覆盖,悬停后侧文本变为白色。
这是工作示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- menu font awesome css -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css">
<!-- jquery -->
<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<!-- momentum -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<!-- bootstrap 4 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' rel='stylesheet' />
<script src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/js/tempusdominus-bootstrap-4.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet"/>
</head>
<style>
.input-group {
max-width: 200px;
}
.label_column {
width: 30%;
}
.table > tbody > tr > td {
vertical-align: middle;
}
.status {
color: LawnGreen;
font-size: 15px;
}
.bootstrap-datetimepicker-widget.dropdown-menu {
width: 300px;
height: 300px;
}
.datepicker table tr td {
border-radius: 0%;
border:dotted 1px black;
background-color: SkyBlue;
background-image: linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
color: black;
}
.datepicker thead tr th:hover {
color: black;
}
</style>
<body>
<table class="table table-sm table-hover table-borderless table-dark">
<tbody>
<tr>
<td>
<div class="form-group">
<div class="input-group date" id="date_time_picker_csd" data-target-input="nearest">
<input type="text" class="form-control datetimepicker-input" data-target="#date_time_picker_csd"
name="signing_date" required/>
<div class="input-group-append" data-target="#date_time_picker_csd" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar-alt"></i></div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(function () {
$('.input-group').datetimepicker({
format: 'YYYY-MM-DD',
});
});
</script>
</body>
</html>
问题:
如何更改 css 或 js 以禁用日期选择器中前两行的悬停?
【问题讨论】:
-
你的意思是行数?
-
@MatanSanbira 不,我的意思是月份和日期。将鼠标悬停在任何日期名称上后,根据表格 css 设置,日期文本名称颜色将变为白色。
-
这是因为您的 CSS 干扰了 Bootstrap 使用的默认 CSS。使您的选择器更具体,而不是全局选择
td/tr元素。 -
移除
table-dark类,它将文本颜色变为白色。 -
@CodingOtaku table-dark 必须保留
标签: javascript jquery html css bootstrap-4