如果任何子项被禁用,请更改悬停样式
我有一张桌子,风格非常漂亮。 Td 和 th 元素在悬停时会更改其背景颜色。但是,如果该行中有禁用元素,它仍然显示比其中包含禁用元素的内容更浅的颜色。如果内部有禁用元素,有谁知道如何更改悬停背景?我可以使用 jQuery。
I have a table, with a pretty nice style. Td and th elements, on hover, change their background color. However, if there is a disabled element in that row, it still displays lighter colors than things with disabled elements in them should look. Does anyone know a way to change the hover background if there is a disabled element inside? I can use jQuery.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能会通过向悬停项目添加一个类来解决这个问题,以在禁用子元素时修改其行为,因为 css 不允许您根据子元素的属性在父对象上设置样式。查看这篇文章:
活动子级父级的复杂 CSS 选择器
I'd probably approach the problem by adding a class to the hovered item to modify its behavior when you disable child elements, as css won't let you set styles on a parent object based on properties of their children. Check out this post:
Complex CSS selector for parent of active child