Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap - Disable responsiveness on certain pages

I'm using the Bootstrap framework for a web application. The responsive design works very well for the primary part of our site which needs to work on smaller screens. However, there's an admin section where the responsiveness is both not that necessary (will be administered on desktops) and gets in the way (the forms/tables require tweaking to work at smaller sizes).

Is there an easy, scalable way to turn off bootstrap responsiveness for certain pages?

Right now, we have a single bootstrap .css file with the @sizing elements included. I could separate out boostrap.css and bootstrap-responsive.css and then only call responsive on pages that need it. I presume that would work, but would mean yet another setting (it's a cakePHP app).

Ideally, I'd like to assign a class to the body or main container that would override the responsiveness -- <div class="container non-responsive">

One other note -- I'm really only concerned about the responsiveness below 1024px in this case. The way it expands in larger screen sizes works well in the admin section.

like image 864
Voodoo Avatar asked Jun 11 '13 21:06

Voodoo


People also ask

What is D block in bootstrap?

d-block , . d-inline , or . d-inline-block to simply set an element's display property to block , inline , or inline-block (respectively). To make an element display: none , use our responsive utilities instead.

Is bootstrap completely responsive?

Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.

What does D None mean?

Use the d-none class to hide an element. Use any of the d-*-none classes to control WHEN the element should be hidden on a specific screen width.


1 Answers

Separating them will be easier even though it's another setting. When you download Bootstrap from their home page (http://twitter.github.io/bootstrap/, instead of via their Customize page or via the GitHub project) it already separates the responsive styles into a separate file.

However, you can add your own styles that are more specific than each of the responsive styles in Bootstrap and override them. It could get hairy though because you'd basically have to repeat everything in bootstrap-responsive.css and override manually for each style property specified by Bootstrap's responsive file.

A better approach might be to edit bootstrap-responsive.css and prefix each style within the media query with ".responsive " and add the "responsive" class to the body element of the pages that you DO want to be responsive.

Hope this helps.

like image 142
Tim Franklin Avatar answered Nov 15 '22 10:11

Tim Franklin