CSS3正在选择最后一个子元素,但它不应该';T
此CSS规则高亮显示最后一个td元素,尽管它不应该高亮显示CSS3正在选择最后一个子元素,但它不应该';T,css,Css,此CSS规则高亮显示最后一个td元素,尽管它不应该高亮显示 <tbody> {% for thread in object_list %} <tr id="unanswered_threads"> {% load staticfiles %} <td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.thread_i
<tbody>
{% for thread in object_list %}
<tr id="unanswered_threads">
{% load staticfiles %}
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.thread_id }}</td>
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.subject }}</td>
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.latest_post_date }}</td>
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.author_username }}</td>
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.last_modified_by }}</td>
<td onclick="gotoLink('{{ thread.url }}');" class="urlLink">{{ thread.assigned_user }}</td>
<td class="action_button"><a href="/assign_thread/{{ thread.thread_id }}"><img src="{% static 'img/icon_red.gif' %}"></img></a></td>
</tr>
{% endfor %}
</tbody>
这个CSS的阅读方式,
“选择不是第一个子元素的任何td元素,该元素是id属性等于未应答线程的任何元素的后代,并且处于悬停状态。”在
最后一个子元素之前缺少冒号
#unanswered_threads:hover td:not(:last-child) {
cursor: pointer;
background-color: #2a6496 !important;
}
虽然看起来您尝试执行的逻辑有点奇怪,但您可能希望将其更改为:
#unanswered_threads td:not(:last-child):hover {
cursor: pointer;
background-color: #2a6496 !important;
}
遗漏了冒号,将错误标记为输入错误
#unanswered_threads td:not(:last-child):hover {
cursor: pointer;
background-color: #2a6496 !important;
}