简体   繁体   中英

Select first td of second tr in CSS

I have working jQuery code that selects second tr and find first td there:

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? This gives no result:

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

You can use the :nth-child , in CSS:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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