show/hide html table columns using css

后端 未结 4 1135
野性不改
野性不改 2020-12-01 07:29

I want to display a basic html table with controls to toggle showing/hiding of additional columns:

4条回答
  •  感情败类
    2020-12-01 08:14

    if you're looking for a simple column hide you can use the :nth-child selector as well.

    #tableid tr td:nth-child(3),
    #tableid tr th:nth-child(3) {
        display: none;
    }
    

    I use this with the @media tag sometimes to condense wider tables when the screen is too narrow.

提交回复
热议问题