如何在sigle表行HTML中突出显示表列 [英] How to highlight table column in a sigle table row HTML

查看:77
本文介绍了如何在sigle表行HTML中突出显示表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能给我一个示例代码来突出显示单个HTML表格中的多个列。

我这样做: JSFIDDLE [ ^ ]

Could you give me a sample code to highlight multiple column in a single row of HTML table.
I follow this : JSFIDDLE[^]

推荐答案

表单按行分组,而不是按行组织。因此,您可以突出显示一行只更改一个元素的样式(< tr> ),而不是列。要突出显示列,您需要突出显示每个< td> (以及< th> )对应于此列。您可以通过将样式应用/切换到每个元素来实现。使用JavaScript非常容易,特别是如果你使用jQuery:

http:// api。 jquery.com/category/css/ [ ^ ],

http://api.jquery.com/css/ [ ^ ],

http://api.jquery.com/addClass/ [ ^ ],

http://api.jquery.com / removeClass / [ ^ ],

http://api.jquery.com/toggleClass/ [ ^ ]。



如果你需要学习jQuery(强烈推荐),请参阅:

http://en.wikipedia.org/wiki/JQuery [ ^ ],

http://jquery.com/ [ ^ ],

http://learn.jquery.com/ [ ^ ],

http://learn.jquery.com/using-jquery-core/ [ ^ ],

http://learn.jquery.com/about-jquery/how-jquery-works/ [ ^ ](从这里开始)。



-SA
The form is organized like an HTML hierarchy by rows, not by columns. Therefore, you can highlight a row be the change the style of just one element (<tr>), but not a column. To highlight a column, you would need to highlight each <td> (and, optionally, <th>) corresponding to this column. You can do it by applying/switching a style to each of those element. It is pretty easy to do with JavaScript, especially if you use jQuery:
http://api.jquery.com/category/css/[^],
http://api.jquery.com/css/[^],
http://api.jquery.com/addClass/[^],
http://api.jquery.com/removeClass/[^],
http://api.jquery.com/toggleClass/[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^],
http://learn.jquery.com/[^],
http://learn.jquery.com/using-jquery-core/[^],
http://learn.jquery.com/about-jquery/how-jquery-works/[^] (start from here).

—SA


这篇关于如何在sigle表行HTML中突出显示表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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