Foundation 5 how to make one column for small screen - css

I have the following grid using zurb-foundation:
<div class="row">
<div class="small-6 large-3 columns"> </div>
<div class="small-6 large-9 columns"> </div>
</div>
The above grid makes the layout of two columns. However, I want to know in small screens to make the above layout to be one column layout instead of two columns with 6. In other words, I want the second div of that row to act as a new row for small screens.

Assuming you are using the standard 12 column grid and haven't modified that, just make the small ones 12:
<div class="row">
<div class="small-12 large-3 columns"> </div>
<div class="small-12 large-9 columns"> </div>
</div>
Just know that small filters it's way up... so in this example "medium" will also be 12. If you want medium to look like large, then do this:
<div class="row">
<div class="small-12 medium-3 columns"> </div>
<div class="small-12 medium-9 columns"> </div>
</div>
Notice how you don't need the large in the above example as medium filters up to everything above it.

using the below Html you can have offset and have centered div on mobile screen.and have large-3 and large-9 div respectively on larger screens.
<div class="row">
<div class="small-6 small-offset-3 large-3 large-offset-0 columns ">..</div>
<div class="new small-6 small-offset-3 large-9 large-offset-0 columns">..</div>
</div>
In foundation css column last child is floated right.so we change it to float left to have both the div stacked up on after the other
.new{
float:left;
}

Something like this should work:
<div class="row">
<div class="medium-6 large-3 columns">
<div class="small-6 medium-12 large-12 columns">column 1</div>
</div>
<div class="medium-6 large-9 columns">
<div class="small-6 medium-12 large-12 columns">column 2</div>
</div>
</div>
http://jsfiddle.net/6tMZH/

should be a simple fix:
.columns {
width:100%;
}
You can see it here

Related

Bootstrap grid displays columns as rows

I have bootstrap grid
<div class="container">
<div class="row">
<div class="col-sm-1">Column 1</div>
<div class="col-sm-2">Column 2</div>
<div class="col-sm-1">Column 3</div>
</div>
<div ng-repeat="Item in Items">
<div class="row">
<div class="col-sm-2">{{Item.Field1}</div>
<div class="col-sm-4">{{Item.Field2}}</div>
<div class="col-sm-6">{{Item.Field3}}</div>
</div>
</div>
</div>
It should display a 3-column grid, instead the columns are displayed as rows. What am I doing wrong?
So your first row is the like the "header" and the next row are the records. Your header is 1-2-1 but your records are 2-4-6 => it won't line up. To keep it from stacking even on small screens you can do col-xs-x instead.
<div class="row">
<div class="col-xs-3">Column 1</div>
<div class="col-xs-6">Column 2</div>
<div class="col-xs-3">Column 3</div>
</div>
<div ng-repeat="Item in Items">
<div class="row">
<div class="col-xs-3">{{Item.Field1}</div>
<div class="col-xs-6">{{Item.Field2}}</div>
<div class="col-xs-3">{{Item.Field3}}</div>
</div>
</div>
I'm assuming you want them to always line up. Bet way to do that will be this:
<div class="container">
<div class="row">
<div class="col-sm-2">Column 1<br>
{{Item.Field1}}
</div>
<div class="col-sm-2">Column 2<br>
{{Item.Field2}}</div>
<div class="col-sm-2">Column 3<br>
{{Item.Field3}}</div>
</div>
</div>
Alternatively, you can replace the br and wrap the elements in divs and display: block;
Working example here:
http://www.bootply.com/tb10AKqzM1
Having put in the code myself, it actually does work. It will put in rows when the viewport size is below the small viewing size (so xs, extra small size). If you want to view it on all viewing sizes then you would have to add xs instead of s to all your classes.

Bootstrap push-pull and keep columns in same order?

I've been reading about the push and pull classes in bootstrap, and need to use them, but I'm having some issues. It seems that the default behavior is to rearrange the columns when pushing/pulling.
Example here shows that the on mobile, Column A displays first, but on desktop, Column B displays first. How can I change this so that Column A displays first on both mobile and desktop? I have a logo in what should be the left/top column, and paragraphs in the right/bottom column.
<div class="container">
<div class="row">
<div class="col-sm-6 col-sm-push-6">
<div class="content">
<h1>Column A</h1>
</div>
</div>
<div class="col-sm-6 col-sm-pull-6">
<div class="content">
<h1>Column B</h1>
</div>
</div>
</div>
</div>
You don't need to use push/pull to make column A appear first. Remove the push/pull and the A will appear before B, and B will wrap below on a smaller screen. The sm md lg will influence WHEN wrapping occurs.
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="content">
<h1>Column A</h1>
</div>
</div>
<div class="col-sm-6">
<div class="content">
<h1>Column B</h1>
</div>
</div>
</div>
</div>
why do you need the push and pull? if it was just
div class='col-sm-6 col-xs-12' for each div it would work as you want

Foundation - Rows don't clear?

I'm using Zurb Foundation 5 and was looking to have a .row inside of a .row so that the .row could act as a wrapper for multiple columns. This worked great, but when I went to add a background inside of the inner row, it bleeds over into the top row - is this normal behavior?
I have attached a screenshot and the code I am using.
<div class="row" id="banner" >
<div class="large-12 medium-12 columns" style="background:green;">
<h1>Banner/Top</H1>
</div>
<div id="bio" class="row" style="background:red;" >
<div class="large-6 medium-6 columns" >
<h1>LEFT</H1>
</div>
<div class="large-6 medium-6 columns" >
<h1>RIGHT</H1>
</div>
</div>
</div>
Screenshot:
I think you need to put the top banner in it's own row that it takes up the full width. Like this:
<div class="row" id="banner" >
<div class="row">
<div class="large-12 medium-12 columns" style="background:green;">
<h1>Banner/Top</H1>
</div>
</div>
<div id="bio" class="row" style="background:red;" >
<div class="large-6 medium-6 columns" >
<h1>LEFT</H1>
</div>
<div class="large-6 medium-6 columns" >
<h1>RIGHT</H1>
</div>
</div>
</div>
edit: you may need one large-12 column that wraps both the banner+#bio rows

Two left columns and main content in right column

Problem:
Trying to create a layout using Bootstrap 3 that consist of two columns on the left of the page and one main column to the right of the two columns. The two columns on the left should be on top of each other.
Code:
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="widget">
<div class="widget-header">
<h3>Left column 1</h3>
</div>
<div class="widget-content" id="gallery"></div>
</div>
</div>
<div class="col-md-4">
<div class="widget">
<div class="widget-header">
<h3>Left column 2</h3>
</div>
<div class="widget-content" id="gallery"></div>
</div>
</div>
<div class="col-md-8">
<div class="widget">
<div class="widget-header">
<h3>Main column</h3>
</div>
<div class="widget-content">
<div id="map_canvas" style="height: 280px;"></div>
</div>
</div>
</div>
</div>
</div>
Output:
Current code produce two columns next to each other on top the main column.
Desired output:
You should use a div with class .col-sm-4 and .col-sm-8 respectively as the parent div for the two column layout you want to use and then create the desired widgets within those divs.
Check out my JSFiddle: http://jsfiddle.net/nJtX9/9/
Please make sure to enlarge the results window to see the correct layout. Otherwise it will stack the div containers for responsive purposes.
You are using 2 col-md-4 meaning is taking 8 columns already + using col-md-8 = 16 columns, bear in mind bootstrap can contain 12 columns per row,
so the way to go around this is use col-md-2 instead of col-md-4
Hope i make this clear.
<div class="container">
<div class="row">
<div class="col-sm-6" style="background-color:gray">
<div class="row" style="background-color:aliceblue">
<h1>col1----row1</h1>
</div>
<div class="row">
<h1>col1----row2</h1>
</div>
</div>
<div class="col-sm-6" style="background-color: aqua">
<h1>col2-----row<br />col2---row<br />col2---row</h1>
</div>
</div>
</div>

Twitter bootstrap columns resizing

I have a layout with two columns, and in the first column I have sub columns. So something like:
<div class="row">
<div class="span8">
<div class="row">
<div class="span1"></div>
<div class="span4"></div>
<div class="span1"></div>
<div class="span1"></div>
<div class="span1"></div>
</div>
</div>
<div class="span4">
</div>
</div>
When the page is resized to be smaller, I would like the two outer columns to stack on top of each other, but not the inner columns as they always need to be on the same line i.e. once the page is resized below the width of the span8 it then introduces a horizontal scroll bar.
Is this possible?
<div class="row">
<div class="span8 container-fluid">
<div class="row-fluid">
<div class="span1 offset2"></div>
<div class="span4"></div>
<div class="span1"></div>
<div class="span1"></div>
<div class="span1"></div>
</div>
</div>
<div class="span4">
</div>
</div>
If you use a fluid layout inside of span8, the content in it should stay on the same line.
And, I don't know if you're aware, but a row is always 12 columns, even if it's in a span8.
I hope you know what I mean. Sorry for my bad english.

Resources