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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -