html - CSS 跟随表类但跳过 tr id
问题描述
我有这个:
table.eshop {
border-collapse: collapse;
}
table.eshop tr {
border: 1.5px solid #d8d8d8;
border-style: none none solid solid;
-webkit-transition: 500ms;
-moz-transition: 500ms;
-o-transition: 500ms;
transition: 500ms;
}
table.eshop:not(#eshop_header) tr:hover {
border-left: 7px solid #61ce70;
}
table.eshop td {
height: 55px;
padding: 0px 20px;
}
table.eshop a {
font-family: Verdana;
color: black;
text-decoration: none;
-webkit-transition: 300ms;
-moz-transition: 300ms;
-o-transition: 300ms;
transition: 300ms;
}
table.eshop a:hover {
color: #f77326;
}
#eshop_header {
font-size: 23px;
color: black;
font-weight: bold;
}
在html中:
<center>
<table width=100% class=eshop>
<tr><td align=left valign=middle width=100% id=eshop_header>CATEGORY</td></tr>
<tr><td align=left valign=middle width=100%><a href=index.php?page=eshop&category=something1>something1</a></td></tr>
<tr><td align=left valign=middle width=100%><a href=index.php?page=eshop&category=something2>something3</a></td></tr>
<tr><td align=left valign=middle width=100%><a href=index.php?page=eshop&category=something3>something3</a></td></tr>
</table>
</center>
并且基本上我需要CSS(tr:hover)不要遵循<tr>
where id = eshop_header。
如您所见,我尝试过不(#eshop_header)但它不起作用:(
解决方案
根据我的理解,您试图不对 id 为 eshop_header 的 div 产生悬停效果。尝试将其添加到您的 css 中:
table.eshop tr:not(:first-child):hover {
border-left: 7px solid #61ce70;
}
*同时引用您的类和 id 属性名称
推荐阅读
- php - 为什么 php echoed image 只显示图像的缩略图?
- python-3.x - 如何创建一个连接可变数量矩阵的函数?
- sql-server - 合并复制实际存储数据的位置在哪里?
- hadoop - Hive JDBC Mapreduce
- hadoop - 如何对 PIG 中的 python UDF 进行故障排除
- xml - XML::Twig 修改多个元素的文本
- regex - 正则表达式在分隔符之间找到一大块文本
- javascript - 如何捕获单击以关闭除模式之外的所有内容的模式
- javascript - vue 事件不起作用 - nuxtjs 静态网站
- php - 这段 PHP 代码有什么功能?