html:hover表列 [英] html: hover table column

查看:302
本文介绍了html:hover表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标移动到 column 时,如何更改html表的背景列

How can I change the background column of an html table column when the mouse is over it?

/ p>

Preferably with css only.

推荐答案

仅适用于单元格或行,对不起。
例如

Only works for cells or rows, sorry. e.g.

td {
  background-color: blue;
}

td:hover {
  background-color: red;
}

有可用的JavaScript解决方案,但现在CSS中没有什么可以做你想要的因为选择器的限制。

There are JavaScript solutions available but nothing in CSS right now will do what you want because of the limitations of selectors.

td  /* all cells */
{ 
  background-color: blue;
}

tr /* all rows */
{
  background-color: pink;
}

/* nothing for all columns */

这篇关于html:hover表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆