简体   繁体   English

在CSS中选择第二个tr的第一个td

[英]Select first td of second tr in CSS

I have working jQuery code that selects second tr and find first td there: 我有工作的jQuery代码,选择第二个tr并在那里找到第一个td:

var tr = jQuery("table#layoutsTable tbody tr").eq(2);
var td = jQuery(tr).find("td:first");
td.css({"width":"64.95%"});

But how to transform it in CSS? 但是如何在CSS中进行转换? This gives no result: 这没有结果:

table#layoutsTable tbody tr:eq(2) td:first {
  width:64.95%;
}

You can use the :nth-child , in CSS: 您可以在CSS中使用:nth-child

<style>
table#layoutsTable tbody tr:nth-child(2) td:first-child {
  width:64.95%;
}
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM