I'm using DataTables.net + Twitter Bootstrap and the responsive layout, what I'm trying is to hide some columns of the table using the class "visible-desktop" thats shows the columns only in big sizes but It seems not to work, hides well but if I resize the windows to get a desktop width the columns hidden start showing stacked, seems a CSS display class problem, because inherits the type of display from the parent:
.visible-desktop {
display: inherit!important;
}
If I manipulate it to
.visible-desktop {
display: table-cell!important;
}
works well... Is there a workaround for this? Or I have to write my own class for table column hiding?
On the table you now need to enable flex box by adding the class d-flex , and drop the xs to allow bootstrap to automatically detect the viewport. Table column width use the same layout as grids do; using col-[viewport]-[size] . Remember the column sizes should total 12; 1 + 3 + 3 + 5 = 12 in this example.
(law) Abbreviation of columns.
"D-" is kind of utilities for Bootstrap that effect on Display directly and help you to have Grid Layout. In Css we call that "Display".
With the help of media queries, Bootstrap gives different widths to the . container depending on the size of the device: Extra small devices (<768px): width: auto (or no width) Small Devices (≥768px): width: 750px.
EDIT: Bootstrap 4 removed hidden
and visible
classes, see this answer for updated examples, and/or related official migration guide.
** Old Answer for Bootstrap 3 below **
Available classes for .visible
and .hidden
.
Use a single or combination of the available classes for toggling content across viewport breakpoints.
From Bootstrap section here http://getbootstrap.com/css/#responsive-utilities-classes
I finally found that exists a workaround replacing:
visible-desktop
by
hidden-phone hidden-tablet
Hope helps someone!
On Boostrap 3.0 use .visibilty-<size>
or .hidden-<size>
responsive classes as described in the official doc.
http://getbootstrap.com/css/#responsive-utilities-classes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With