Can I color table columns using CSS without coloring individual cells?

前端 未结 8 467
不思量自难忘°
不思量自难忘° 2020-12-12 13:07

Is there a way to color spans of columns all the way down. See, starting example below:

8条回答
  •  离开以前
    2020-12-12 13:55

    You can use the nth-child selector for that:

    tr td:nth-child(2),
    tr td:nth-child(3) {
      background: #ccc;
    }
    headline 1 headline 2
    column 1 column 2 column 3
    column 1 column 2 column 3
    column 1 column 2 column 3

提交回复
热议问题