Tablesorter 如何禁用嵌套表的样式?

Tablesorter how to disable styling for nested tables?

我正在使用 tablesorter 来设置 table 的样式,在 table 我也有一个嵌套的 table,我想设置不同的样式,但是table排序器 类 和样式覆盖我的。

有没有办法防止嵌套的 table 继承 table 排序器样式?

您可能需要修改 css 以在您沿着 DOM 树向下移动时在每个元素之间添加 css child selectors...这使得定义非常具体 table 个元素需要设置样式。

例如,如果您的外层 table 的 ID 为 "outer",则此 css 只会设置外层 table:

的样式
/* header cells */
#outer > thead > tr > th { background: blue; color: white; }
/* zebra striping */
#outer > tbody > tr { background: white; }
#outer > tbody > tr:nth-child(2n) { background: lightblue; }

嵌套的 table 将不会被上面的 css 设置样式(除非它们没有设置样式)。然后,您将需要遵循相同的模式,使用自己的特定 ID 或 class 和每个元素之间的子选择器来设置嵌套 table 的样式。