Using Bootstrap 3 how can I hide columns in my table?

前端 未结 1 605
醉梦人生
醉梦人生 2021-02-11 17:42

I\'m trying to hide columns for my responsive design when in col-xs and col-sm. I first attempted to use hidden-xs/hidden-sm classes, but

相关标签:
1条回答
  • 2021-02-11 18:38

    The code should work just fine. Bootstrap supports hiding/showing th and td with its responsive utility classes https://github.com/twbs/bootstrap/blob/master/less/mixins.less#L504:

    // Responsive utilities
    // -------------------------
    // More easily include all the states for responsive-utilities.less.
    .responsive-visibility() {
      display: block !important;
      tr& { display: table-row !important; }
      th&,
      td& { display: table-cell !important; }
    }
    
    .responsive-invisibility() {
      display: none !important;
      tr& { display: none !important; }
      th&,
      td& { display: none !important; }
    }
    

    The code works in this jsFiddle: http://jsfiddle.net/A4fQP/

    0 讨论(0)
提交回复
热议问题