:nth-child/:first-child/:last-child选择器易错点

$("tr td:first-child").css("width","35%");

上面的代码含义是:将tr下的第一个td宽度设置为35%

很容易让人错误地理解为,将td下的第一个子元素的宽度设置为35%

你可能感兴趣的:(:nth-child/:first-child/:last-child选择器易错点)