且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让第二个孩子使用CSS?

更新时间:2023-12-03 09:54:52

对于现代浏览器,使用 td:nth-​​child(2)第三个是c $ c> td 和 td:nth-​​child(3)请记住,这些会为每一行检索第二个和第三个 td

For modern browsers, use td:nth-child(2) for the second td, and td:nth-child(3) for the third. Remember that these retrieve the second and third td for every row.

需要与IE早于版本9的兼容性,使用同级组合器或JavaScript 。另请参阅我对此相关问题,以解释和说明他的方法。

If you need compatibility with IE older than version 9, use sibling combinators or JavaScript as suggested by Tim. Also see my answer to this related question for an explanation and illustration of his method.