css3 - CSS how to use pseudo-class :not with :nth-child -


It is possible to use

: not () with nth-child ?

I tried to do this without any luck:

  td: not (: nth-child (4n)) {text-align: center; }   

Although this works:

  td: not (: first-child) {text-align: center; }   

I am trying to align all the table columns in the middle except 2 and 4 columns. Columns are dynamically generated to add a custom class to these columns.

: no (: nth-child (4n)) Which is not : nth-child (4n) , which is not the fourth, 8th and so on. This will not leave the second child because 2 in 4 are not valuable.

To exclude the second and fourth, you need one of these:

  • td: no (: nth-child (2n)) < / Code> If you have less than 6 columns, or

  • td: not (: nth-child (2)): no (: nth-child ( 4)) If you have at least 6 columns and do not want to leave only 2 and 4th and only every column.



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -