KindOfGuy
KindOfGuy

Reputation: 3211

Why won't my Bootstrap CSS divs stack nicely?

I'm having trouble with Bootstrap which some people here seem to know about. I have set up the following two divs according to the basic "row" class grid conventions, yet they are not stacking as expected when I reduce the size of the browser screen. They just stay fixed.

Update:

Bootstrap became responsive when I linked to the bootstrap-responsive.css file, as suggested below.

However, the boxes stretch beyond the maximum grid size I had intended and set (i.e. the default of 940px which came in the original installation and I re-affirmed by compiling it all again with LESS). Moreover, it actually stretched beyond the far-right extent of the browser window. Screenshot from Chrome (17.0.963.56) (more markup visible in developer tools in screenshot):

http://static.inky.ws/image/1457/image.jpg

This happens with and without the inclusion of:

Maybe I am using bootstrap in the wrong way, but I want it to behave responsively on selected divs (classed as "row", "spanX", etc.) but to stop at the max grid width of my choosing, and at least to stop at the far extent of the window!

Thanks again for your time, Matt

HTML:

<div class="row-fluid"><!-- Intro begin -->
    <div class="span6">
        <p style="font-size: 18px;">
            <strong><span style="font-size: 20px;">Mingo makes it easy to share food with other people in your area.</span></strong>
        </p>
    </div>

    <div class="span6">
        <!--<img src="{{STATIC_URL}}images/pics/how_it_works.png" width="350px" style="margin-right: 20px;" />-->
        <div style="background-color: #E7F5DF; height: 250px; padding: 8px; border-radius: 8px;">
            <ul class="nav nav-pills" style="float: right;">
                <li class="active"><a href="#">How it works</a></li>
                <li><a href="#">Save time, save money</a></li>
            </ul>
            <div style="width: 99.5%; height: 87.5%; background-color: #c6e3b6; margin: 9.5% 0 0; border-radius: 8px; moz-border-radius: 8px;">
            </div>
        </div>
    </div>
</div><!-- Intro end -->

Upvotes: 1

Views: 4568

Answers (2)

Ivo Bosticky
Ivo Bosticky

Reputation: 6408

Don't forget to include

<meta name="viewport" content="width=device-width, initial-scale=1.0">

in your html header, otherwise the mobile browsers zoom out rather then changing the layout to fit the screen width.

Upvotes: 2

TimPetricola
TimPetricola

Reputation: 1491

Maybe you have only included the bootstrap.css stylesheet and not the bootstrap-responsive.css stylesheet?

If that is the case, try to include both.

With your HTML markup and both CSS files, it seems to works : http://jsfiddle.net/TimPetricola/KFnxs/

Upvotes: 5

Related Questions