Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter bootstrap reorder elements on small devices

I have the following layout on a page: enter image description here
On the left I have the desktop (lg) version, And on the right the reordering that I want to have on the small devices.

With this code:

        <div class="row">
            <div class="col-sm-6 col-sm-push-6">
                <div class="alert alert-danger"><h1>Lorem Ipsum (2)</h1>
                    <br>
                    Rostfreie Bohrbefestiger für Stahl- und Aluminiumunterkonstruktionen </div>
            </div>
            <div class="col-sm-6 col-sm-pull-6">
                <div class="alert alert-info">Image (1)

                    <p></p>

                    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.<p>
                    <p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata .</p>

                    <p></p>

                    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.<p>
                    <p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata .</p>

                </div>
            </div>

        </div>

        <div class="row">

            <div class="col-md-6 col-md-offset-6 col-sm-6 col-sm-offset-6 col-lg-offset-6">
                <div class="alert alert-info">Description (3)</div>
            </div>

        </div>

I get a Problem with the desktop view: see printscreen: enter image description here

Any proposals to fix that problem and to show the description element (3) direct under element "2" are welcome.

Thanks a lot.

like image 826
Ahmed Ala Dali Avatar asked Feb 15 '16 15:02

Ahmed Ala Dali


People also ask

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

By default, this will display the main content first. So in mobile, the main content will be displayed first. Try using col-lg-push and col-lg-pull to reorder the columns in large screens and display the sidebar on the left and main content on the right.

How we define grid for extra small devices in Bootstrap?

Bootstrap Grid - Small Devices Tip: Small devices are defined as having a screen width from 768 pixels to 991 pixels. For small devices we will use the . col-sm-* classes. Now Bootstrap is going to say "at the small size, look for classes with -sm- in them and use those".

What is XS SM MD lg in Bootstrap?

The Bootstrap 3 grid system has four tiers of classes: xs (phones), sm (tablets), md (desktops), and lg (larger desktops). You can use nearly any combination of these classes to create more dynamic and flexible layouts.

What is Col SM 4 in Bootstrap?

col-sm-4 are available for quickly making grid layouts. Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on .


1 Answers

Try the following:

<div class="row">
    <div class="col-sm-12 col-lg-6 pull-right">
        <div class="alert alert-danger"><h1>Lorem Ipsum (2)</h1>
            <br>
            Rostfreie Bohrbefestiger für Stahl- und Aluminiumunterkonstruktionen </div>
    </div>
    <div class="col-sm-12 col-lg-6 pull-left">
        <div class="alert alert-info">Image (1)

            <p></p>

            <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.<p>
            <p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata .</p>

            <p></p>

            <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.<p>
            <p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata .</p>

        </div>
    </div>

    <div class="col-sm-12 col-lg-6 pull-right">
        <div class="alert alert-info">Description (3)</div>
    </div>

</div>
like image 188
Ricky Barnett Avatar answered Dec 03 '22 01:12

Ricky Barnett