Issue
I am using bootstrap for the first time to work on a project of mine. And from what I can tell container>row works fine, which begs the questions is container>row>span12 needed, or is it just best practice?
Thank you
Solution
The question is confusing.
Bootstrap works by using a floated grid system. Looking at the source below should clear up what is going on. The .container
class sets a width of 940px, as does the .span12
class. The .row
class is a div with a clearfix on it to contain a row of floated .span
columns. All .spanXX
classes are floated left and given 20px left margin to create the grid.
If all you are using is a container and a row, you are just creating a 940px wide container with -20px left-margin. You should still use .span12
to keep consistent with the framework and set the margin correctly. This raises the question, why are you using a grid layout in the first place if you don't want to take advantage of the columns. If all you want is a 940px container then just create one.
From bootstrap.css:
.row {
margin-left: -20px;
*zoom: 1;
}
.row:before,
.row:after {
display: table;
line-height: 0;
content: "";
}
.row:after {
clear: both;
}
[class*="span"] {
float: left;
margin-left: 20px;
}
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container {
width: 940px;
}
.span12 {
width: 940px;
}
Answered By - Dan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.