Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 only for mobile

I have a site 1600px wide and I want to make that fit nicely on mobile only. How can I do with Bootstrap 3. I tried to use col-sm-*. but also effects on larges screens because existing site is not coded as per Bootstrap grid. Is there any way I can use Bootstrap without effecting large screen?

like image 943
Monkviper Avatar asked Oct 03 '13 19:10

Monkviper


People also ask

Is bootstrap 3 is mobile first?

Mobile first With Bootstrap 3, we've rewritten the project to be mobile friendly from the start. Instead of adding on optional mobile styles, they're baked right into the core. In fact, Bootstrap is mobile first.

Which is better bootstrap 3 or 4?

Bootstrap 3 used floats to handle the layout unlike flexbox in Bootstrap 4. The Flexible Box Layout makes it easier to design flexible responsive layout structure without using float or positioning. Although it has responsive features, with custom CSS the implementation has become complex with Bootstrap 4.

Can I use bootstrap 3 and 4 together?

It's not possible to integrate both bootstrap3 and bootstrap 4 because of many classes of the bootstrap library with the same name.

Is bootstrap a mobile?

Bootstrap · The world's most popular mobile-first and responsive front-end framework. Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.


2 Answers

If you're looking to make the elements be 33.3% only on small devices and lower:

This is backwards from what Bootstrap is designed for, but you can do this:

<div class="row">
    <div class="col-xs-4 col-md-12">.col-xs-4 .col-md-12</div>
    <div class="col-xs-4 col-md-12">.col-xs-4 .col-md-12</div>
    <div class="col-xs-4 col-md-12">.col-xs-4 .col-md-12</div>
</div>

This will make each element 33.3% wide on small and extra small devices but 100% wide on medium and larger devices.

JSFiddle: http://jsfiddle.net/jdwire/sggt8/embedded/result/

If you're only looking to hide elements for smaller devices:

I think you're looking for the visible-xs and/or visible-sm classes. These will let you make certain elements only visible to small screen devices.

For example, if you want a element to only be visible to small and extra-small devices, do this:

<div class="visible-xs visible-sm">You're using a fairly small device.</div>

To show it only for larger screens, use this:

<div class="hidden-xs hidden-sm">You're probably not using a phone.</div>

See http://getbootstrap.com/css/#responsive-utilities-classes for more information.

like image 197
Joshua Dwire Avatar answered Oct 11 '22 16:10

Joshua Dwire


I found a solution wich is to do:

<span class="visible-sm"> your code without col </span>
<span class="visible-xs"> your code with col </span>

It's not very optimized but it works. Did you find something better? It really miss a class like col-sm-0 to apply colons just to the xs size...

like image 44
user3417911 Avatar answered Oct 11 '22 14:10

user3417911