2
votes

EDIT: After implementing the accepted answer below, I have the following, which is what I originally had before implementing any push/pull tactics. Thus the problem persists. Any suggestions that could help achieve the desired layout on small screens are welcome.

----------------------------
|  Left Sidebar  |         |
------------------  Main   |
|                |         |
|                |         |
|                |         |
|                |         |
|                |         |
-----------------|---------|            
|  Right         |
------------------

I have 3 columns in one row in a fluid container (container-fluid). I have been trying to align them correctly on screen size changes all day, but to no avail.

1: right sidebar

2: left sidebar

3: main

What it looks on big screens:

------------------------------------------------
|   Left sidebar  |      Main      |  Right Sidebar |
------------------------------------------------

What it should look like on smaller screens:

----------------------------
|  Left Sidebar  |         |
------------------  Main   |
|  Right Sidebar |         |
----------------------------

What it looks like now:

-----------------------------
|  Left          |  Main    |
|  Sidebar       ------------
|                |  Right   |
|                | sidebar  |
-----------------------------

I have tried different combination of col-sm-push/pull-x and col-xs-push/pull-x, but none of them have produced the desired output. I kept getting the columns overlapped on top of each other on big screens, instead of nicely beneath each other on smaller screens as intended. How can I achieve the right layout on small screens?

1
Can you post a bootply or fiddle?Dan
@user3694391 I would say that is not the set up you are quite looking for in bootstrap. I am working on a bootply now for you.'Jordan.J.D
Thanks. I'd appreciate anything that helps me move forward.user3694391
@user3694391 alright the new problem i think is because of rows, i will have to think about it and i will update my answer.Jordan.J.D

1 Answers

2
votes

Check out this bootply. I used containers and panels since they look much cleaner. Read about panels and grid i used here. Read about hiding divs here:

<div class="container">
<div class="row">
    <div class="col-sm-8 col-md-4 hidden-xs">
        <div class="panel panel-default">
            <div class="panel-heading text-center">
                    <h3 class="panel-title">left</h3>

            </div>
            <div class="panel-body"></div>
        </div>
    </div>
    <div class="col-sm-4 col-md-4">
        <div class="panel panel-default">
            <div class="panel-heading text-center">
                    <h3 class="panel-title">main</h3>

            </div>
            <div class="panel-body"></div>
        </div>
    </div>
    <div class="col-sm-8 col-md-4 hidden-xs">
        <div class="panel panel-default">
            <div class="panel-heading text-center">
                    <h3 class="panel-title">right</h3>

            </div>
            <div class="panel-body"></div>
        </div>
    </div>
</div>

Preview Large

enter image description here

Preview Small

enter image description here

First you make a row that will contain all your columns of equal width (col-md-4) where col indicated column, md indicates when the width will be seen in terms of screen size (Desktops (≥992px)), and the width with the max being 12. Next you do the same for a different size screen (sm ≥768px), and choose the width for the resized panels. For hiding panels and divs at a certain resolution, bootstrap uses hidden-SCREENSIZE so we add hidden-xs to the left and right panels.