Basic questions on using 960gs - css

I did the below it worked,
<div class="container_12">
<div class="grid_6">Some Text</div>
<div class="grid_6">Some Text</div>
</div>
result: Two boxes inside with 10px left and right margin appeared.
Question 1:
Below does not work, one box is pushed below another why? What should i do to fix it?
<div class="container_12">
<div class="grid_12">
<div class="grid_6">Some Text</div>
<div class="grid_6">Some Text</div>
</div>
</div>
Question 2:
With the MarkUp 1, which i stated at start of question i substitued the text with Google visualization charts, they behave like Question1. One chart is pushed below another.
Question 3
Do i always have to specify clears after the the grids ads up to containers width. for example,
<div class="container_12">
<div class="grid_6">Some Text</div>
<div class="grid_6">Some Text</div>
<div class="clear"></div>
<div class="grid_12"></div>
</div>
Question 4
I have heard that clearfix does the same as clearing, where do i use it on the parent container or the divs inside them?

Question 1
You need to add a class of "alpha" on the first div to remove the left margin and a class of "omega" on the last div to remove the right margin.
Whenever you are nesting divs you need to add alpha and omega classes to the first and last divs.
<div class="container_12">
<div class="grid_12">
<div class="grid_6 alpha">Some Text</div>
<div class="grid_6 omega">Some Text</div>
</div>
</div>
Question 2
This may be because the content ie the charts are wider than the div.
Question 3
Use a clear div when only when you want to clear all the elements above it.
Question 4
Whenever you have a div with floated elements inside it you can give it a class of clearfix to clear everything inside.

Related

How to change first column in bootstrap the distance from left?

I'm using Bootstrap and I want to change first column the distance from left. This is illustrated in this picture:
My code:
<div class="container">
<div class="row">
<div class="col-sm-1">
<div class="panel panel-default">
<div class="panel-body">A Basic Panel</div>
</div>
</div>
<div class="col-sm-8">.col-sm-7</div>
<div class="col-sm-1">.col-sm-1</div>
</div>
</div>
I try with margin-left, padding-left, but I don't found where it's need change.
Change
<div class="container">
to
<div class="container-fluid">
Fiddle here: https://jsfiddle.net/DTcHh/23360/
The .container class adds a max width to that element, and centers it on the page. If you want col-sm-1 all the way to the left, you'll want to remove/adjust how you're using the .container class.
On top of that, .row and .col-sm-* come with some additional margin/paddings. Try using chrome inspector to look at your elements on the page and see how/why they are laid out the way they are.

Susy stack content per column

I have a webpage based on a susy grid, with content like this:
<div class="container">
<div class="column-gallery-item">
<p>Who's down there? Can't see!</p>
</div>
<div class="column-gallery-item">
<p>Lots<br>and lots<br>and lots<br>of content</p>
</div>
<div class="column-gallery-item">
<p>Not much here</p>
</div>
<div class="column-gallery-item">
<p>I want to move up!</p>
</div>
</div>
Each div spans 4 columns of a 12-column grid. The first three divs appear in a single row, the last div moves to the next row - see http://codepen.io/anon/pen/meGJVp .
Now I need the last div to move up, directly below the first one. How can I do so?
If you want the item to stack underneath the first item in the grid then the only way is to nest it in the same column:
<div class="column-gallery-item-stacked">
<div class="nested-column-gallery-item">
<p>Who's down there? Can't see!</p>
</div>
<div class="nested-column-gallery-item">
<p>I want to move up!</p>
</div>
</div>
See here: http://codepen.io/anon/pen/QjVjMK

full width line within bootstrap container

I have bootstrap container (div class="container") and there are two rows (div class="row").
But between those rows I need one full width horizontal line. Full width - I mean that it should be full width - outside container. This line is just for design issues, it would have background color and that is it. I do not know how to create it.
Divide your content into 2:
<div class="container">
<div class="row">
stuff here
</div>
</div>
<div class="line"></div>
<div class="container">
<div class="row">
stuff here
</div>
</div>

Bootstrap columns stacking vertically and not horizontally

I have a row divided into 3 columns using col-sm-4. Now i expect this row to be divided horizontally into three parts. But it's divided vertically.
See on Jsfillde
Here's my code
<div class="container">
<div class="row" style="padding:13px 15px;">
<div class="pull-left span4">
<img src="themes/custom/img/logo.png" width="120" alt="logo"/>
</div>
<div class="pull-right span4">
<div class="row">
<div class="col-sm-4">One</div>
<div class="col-sm-4">Two</div>
<div class="col-sm-4">Three</div>
</div>
</div>
</div>
</div>
I have kept a logo on the left side and on the right side there is a row that i want to divide horizontally in 3 parts.
What am i doing wrong?
Your code works just fine. The .col-sm-* classes are applied for width 768px and above. If you want make this three divs always horizontally, you have to use classes .col-xs-4 in your case. Updated jsfiddle
Futher reading - http://getbootstrap.com/css/#grid-options
I was having the same problem and was at my wits end. Then I refreshed the browser and it worked.

Styling Container background? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to deal with floated elements?
I have a probably basic html css styling question:
If I have:
<div class="container">
<div class="column"> </div>
<div class="column"> </div>
<div class="column"> </div>
</div>
Then... when I style the columns with a background-color they get the background color.
BUT the container somehow does not stretch until the bottom of the content: it only fills content with a background color or any other property if I put "content" in it e.g.:
<div class="container">
<div class="column"> </div>
<div class="column"> </div>
<div class="column"> </div>
one line of background color
</div>
Now I get one line behind the whole thing that is "green" while I want it to stretch the complete thing.
Why does the container not know where the bottom is? Is there anything I can do here?
If you've floated the inner divs, you'll need to add overflow: auto to the container element.
You need to clear your floats. I usually just overflow:hidden the container.

Resources