html - select multiple child in css -
i trying apply ellipsis class in css table. there columns need have ellipsis class. have multiple columns in table.
i doing nth-child
property in css, there way select random multiple child?
i tried-
.listtasktime tbody tr >td:nth-child(3) { text-overflow: ellipsis; width:150px; display: block; overflow: hidden; word-break:keep-all; zoom:normal; line-break:normal; white-space:pre; }
though same table has 1 more column 5th-child
, child need make separate class, hence other columns.
i don't want expand css code. there other solution?
you can separate classes comma ,
.listtasktime tbody tr >td:nth-child(3), .listtasktime tbody tr >td:nth-child(6), .listtasktime tbody tr >td:nth-child(9) { /* common styles goes here, styles apply child 3,6 , 9 */ }
note: need check nth-child
, define manually in stylesheet, css cannot decide if columns increase.
if using server side language generating dynamic table, can use functions substr()
cut down letters.
side note : don't have use >
unless , until don't have child table, sufficient.. tbody tr td:nth-child(3)
Comments
Post a Comment