css实现table表格悬浮高亮标注效果代码

代码语言:html

所属分类:表格

代码描述:css实现table表格悬浮高亮标注效果代码

代码标签: css table 表格 悬浮 高亮 标注

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  
<style>
/*
hover a cell, fill it in red
*/
#bigdata tr > *:hover {
	background: red;
}

/* 
highlight the cells in the row before the hovered cell
*/
#bigdata tr > *:has(~ *:hover) {
	background: rgba(255,0,0,0.33);
}

/*
and now the down-the-column highlighting; it’s hacky but I couldn’t think of another way to make it work with :has()
*/

#bigdata tr:has(~ tr:hover > *:nth-child( 1):hover) > *:nth-child( 1),
#bigdata tr:has(~ tr:hover > *:nth-child( 2):hover) > *:nth-child( 2),
#bigdata tr:has(~ tr:hover > *:nth-child( 3):hover) > *:nth-child( 3),
#bigdata tr:has(~ tr:hover > *:nth-child( 4):hover) > *:nth-child( 4),
#bigdata tr:has(~ tr:hover > *:nth-child( 5):hover) > *:nth-child( 5),
#bigdata tr:has(~ tr:hover > *:nth-child( 6):hover) > *:nth-child( 6),
#bigdata tr:has(~ tr:hover > *:nth-child( 7):hover) > *:nth-child( 7),
#bigdata tr:has(~ tr:hover > *:nth-child( 8):hover) > *:nth-child( 8),
#bigdata tr:has(~ tr:hover > *:nth-child( 9):hover) > *:nth-child( 9),
#bigdata tr:has(~ tr:hover > *:nth-child(10):hover) > *:nth-child(10),
#bigdata tr:has(~ tr:hover > *:nth-child(11):hover) > *:nth-child(11),
#bigdata tr:has(~ tr:hover > *:nth-child(12):hover) > *:nth-child(12),
#bigdata tr:has(~ tr:hover > *:nth-child(13):hover) > *:nth-child(13),
#bigdata tr:has(~ tr:hover > *:nth-child(14):hover) > *:nth-child(14),
#bigdata tr:has(~ tr:hover > *:nth-child(15):hover) > *:nth-child(15),
#bigdata tr:has(~ tr:hover > *:nth-child(16):hover) > *:nth-child(16),
#bigdata tr:has(~ tr:hover > *:nth-child(17):hover) > *:nth-child(17),
#bigdata tr:has(~ tr:hover > *:nth-c.........完整代码请登录后点击上方下载按钮下载查看

网友评论0