How can i hide certain table column in a HTML table using CSS

前端 未结 7 1655
长发绾君心
长发绾君心 2021-01-26 18:05

I have a html table which is as follows

col1 c
7条回答
  •  萌比男神i
    2021-01-26 18:48

    If you always want to show the first 3 colums and hide the rest of the colums in the row you might want to use:

    tr > td:nth-child(n+4)
    {
        visibility: hidden;
    }
    

    This will start at the index of 4 and will loop through the rest and will hide them.

    With visibility: hidden; you will still keep the spacing it had.

    jsFiddle

提交回复
热议问题