短评 · ·

X 归档 2025-02-06

1 条动态 · 图 0 · 视频 1
@jh3yy05:01原推文
<table> highlighting with CSS :has() 💡

td:has(~ td:hover), /* previous sibling cells */
table:has(td:nth-of-type(3):hover) /* column cells */
tr:not(:first-of-type):has(~ tr:hover)
td:nth-of-type(3) {
background: var(--highlighted);
}
用 CSS :has() 高亮 <table> 💡

td:has(~ td:hover), /* 前面的兄弟单元格 */
table:has(td:nth-of-type(3):hover) /* 列单元格 */
tr:not(:first-of-type):has(~ tr:hover)
td:nth-of-type(3) {
background: var(--highlighted);
}