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

前端 未结 6 1313
南笙
南笙 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:35

    I think this is the simplest way: If you have a three column table & a footer of two cell like me then you can apply the below rule:

    tr td:nth-child(3),tfoot tr td:nth-child(2){
        text-align:center;
    }
    

    I know this is very old question. But as a beginner, sometimes ago I faced the same problem & I have solved this like this way.

提交回复
热议问题