[关闭]
@buoge 2017-12-06T16:01:14.000000Z 字数 314 阅读 949

css:中如何让第一个和最后一个不被选中?

前端


tr {
background:#f3f900;
}

不是第一个

tr:not(:first-child):hover {
background: #ffffdd;
}

不是最后一个

tr:not(:last-child):hover {
background: #ffffdd;
}

第一个和最后一个不选中

.a {
width: 80px;
height:60px;
background:#333;
border: #eee solid 1px;
}
.a:not(:first-of-type):not(:last-of-type):hover { /* First-Of-Type 似乎更稳定 */
background: #ffffdd;
}

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注