Is there a way to set the text alignment of entire column in a table?

前端 未结 6 1322
南笙
南笙 2020-12-29 01:11

Is there a simple way to set the text alignment of all cells in the second column to right?

Or is the only way is to set the alignment for each cell in

6条回答
  •  鱼传尺愫
    2020-12-29 01:27

    I believe that the following would work and not require annotating the second cell of each row with a class.

    td:first-child + td { text-align: right; }
    

    This rule would select a td immediately following a td that is the first child of its parent. In a typical table this would select the second cell in each row.

提交回复
热议问题