Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to hide one column from grid in bootstrap mobile version

I think it's a bit tricky that I want to hide one column from a grid in bootstrap mobile version. Let's show example

<div class="row">   <div class="col-xs-9">     <p class="testimonial-about">"We have managed to received good number of applications through MyJobs in comparison to advertising in the newspaper and would recommend MyJobs to other companies to assist with their recruitment needs"</p>   </div>   <div class="col-xs-3 center-image hidden-xs"><img src="myimage.png"/></div> </div> 

Above coding, I hide image portion when viewed by mobile device. What I want is I don't want that spacing of image portion even it's hidden as increasing left portion to reach till the right side.

like image 221
PPShein Avatar asked Jan 29 '16 05:01

PPShein


People also ask

How do I hide columns in Bootstrap?

To hide elements simply use the .d-none class or one of the .d-{sm,md,lg,xl}-none classes for any responsive screen variation.

How do I change Bootstrap 3 column order on mobile layout?

By using col-lg-push and col-lg-pull we can reorder the columns in large screens and display sidebar on the left and main content on the right.

How do I change the column order in Bootstrap 4 for mobile layout?

To do this, you would need to set the source code to be in the order you want it to be on mobile. Then add the order classes to the columns specifying the order at the breakpoint you choose. In our case we want SM and up. Using Bootstrap's order classes you can essentially move columns around like a forklift.


1 Answers

Since Bootstrap V4 the hidden-X classes have been removed. In order to hide a column based on the column width use d-none d-X-block. Basically you simply turn off the display of the size you wish to hide then set the display of the bigger size.

  • Hidden on all .d-none
  • Hidden on xs .d-none .d-sm-block
  • Hidden on sm .d-sm-none .d-md-block
  • Hidden on md .d-md-none .d-lg-block
  • Hidden on lg .d-lg-none .d-xl-block
  • Hidden on xl .d-xl-none

Taken from this answer.

like image 89
Andy Braham Avatar answered Sep 18 '22 23:09

Andy Braham