【发布时间】:2021-05-12 13:56:25
【问题描述】:
这是我的代码。我想做一张桌子。当我将鼠标悬停在 .details 或 .time 部分时,只有 details 和 time 部分会悬停 而不是日期 部分。当我将鼠标悬停在 .day 部分时,整个部分将悬停。 示例:当我将在周日悬停时,将悬停三行 .details 和 .time,包括周日。当我将鼠标悬停在 .details 或 .time 部分时,只有该行将悬停,除了 .day 部分。而且我希望该表头在任何情况下都不会悬停。
我尝试了很多方法来修复它,但我无法修复它。
请帮我解决它。先感谢您。 这是我的代码:
table{
width: 100%;
background: white;
}
table,tr,td,th{
border: 2px solid #410d3526;
}
th{
padding: 20px;
font-family: 'Kanit', sans-serif;
text-align: center;
font-size: 20px;
letter-spacing: 1px;
background: #c3143166;
}
th:nth-child(1){
background: #80808040;
}
th:nth-child(3){
background: #80808040;
}
.day{
font-family: 'Itim', cursive;
font-size: 26px;
text-align: center;
background: #80808040;
}
td h3{
font-family: 'Comfortaa', cursive;
font-size: 23px;
margin: 0;
text-align: center;
letter-spacing: 1px;
}
td h4{
font-family: 'Dancing Script', cursive;
font-size: 20px;
text-align: center;
font-weight: bolder;
margin: 0;
}
td h6{
text-align: center;
font-family: 'Comfortaa', cursive;
font-size: 16px;
}
.time{
font-family: 'Pangolin', cursive;
text-align: center;
font-weight: 600;
letter-spacing: 1px;
background: #80808040;
}
tr .details{
background:#240b368f ;
color: white;
}
tr{
transition: 1s;
}
tr:hover{
transform: scale(1.02);
}
tr:hover .details,tr:hover .time,tr:hover .day{
background: linear-gradient(to left, #240b36, #c31431);
color: white;
border: none;
}
<section class="routine-sec">
<div class="container">
<div class="row">
<div class="col-xl-2"></div>
<div class="col-xl-8">
<table>
<tr>
<th>DAY</th>
<th>Cource</th>
<th>TIME</th>
</tr>
<tr>
<td rowspan="3" class="day">Sunday</td>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
<tr>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
<tr>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
<tr>
<td rowspan="2" class="day">Sunday</td>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
<tr>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
<tr>
<td class="day">Sunday</td>
<td class="details">
<h3>Programing structure language</h3>
<h4>Ditee yasmin</h4>
<h6>Cse-510210</h6>
</td>
<td class="time">11:00am</td>
</tr>
</table>
</div>
<div class="col-xl-2"></div>
</div>
</div>
</section>
【问题讨论】: