Is it possible to hide / show table columns by changing the CSS class on the col element only?

前端 未结 3 2046
执笔经年
执笔经年 2021-01-12 01:02

I\'m trying to hide / show columns in a table based on users choices during runtime. I defined two CSS classes:

.hide { visibility: collapse; }

.show { visi         


        
3条回答
  •  误落风尘
    2021-01-12 01:50

    Well Chrome is not really a widely supported browser so technically no one cares if it doesn't work in Chrome (not yet anyway). But why not set visibility to hidden?

    td {
         width:100px;
         height:500px;
         border:solid 1px #000000;
     }
    td#one {
          visibility:hidden;
         background:#ff0000;
     }
    td#two {
         visibility:hidden;
         background:#00ff00;
     }
    td#three {
          visibility:hidden;
         background:#0000ff;
     }
    

提交回复
热议问题