1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 13:38:26 +01:00

last minute addition of a simple fluid grid for our fluid examples; it needs work, so we're not documenting it now

This commit is contained in:
Mark Otto 2012-01-29 13:06:57 -08:00
parent 059ff6bcbd
commit 48529ad01f
10 changed files with 399 additions and 188 deletions

View File

@ -77,6 +77,9 @@
width: auto;
padding: 0 20px;
}
.row-fluid {
width: 100%;
}
.row {
margin-left: 0;
}
@ -162,6 +165,50 @@
.offset11 {
margin-left: 702px;
}
.row-fluid {
width: 102.76243093919337%;
margin-left: -2.762430939%;
}
.row-fluid [class*="span"] {
float: left;
margin-left: 2.762430939%;
}
.row-fluid .span1 {
width: 5.6451612899588115%;
}
.row-fluid .span2 {
width: 13.978494622708812%;
}
.row-fluid .span3 {
width: 22.31182795545881%;
}
.row-fluid .span4 {
width: 30.64516128820881%;
}
.row-fluid .span5 {
width: 38.97849462095881%;
}
.row-fluid .span6 {
width: 47.311827953708814%;
}
.row-fluid .span7 {
width: 55.645161286458816%;
}
.row-fluid .span8 {
width: 63.97849461920882%;
}
.row-fluid .span9 {
width: 72.31182795195882%;
}
.row-fluid .span10 {
width: 80.64516128470882%;
}
.row-fluid .span11 {
width: 88.97849461745884%;
}
.row-fluid .span12 {
width: 97.31182795020881%;
}
}
@media (max-width: 940px) {
body {
@ -169,7 +216,7 @@
}
.navbar-fixed-top {
position: static;
margin-bottom: 36px;
margin-bottom: 18px;
}
.navbar-inner {
padding: 5px;
@ -264,6 +311,12 @@
}
}
@media (min-width: 1200px) {
.thumbnails {
margin-left: -30px;
}
.thumbnails > li {
margin-left: 30px;
}
.container {
width: 1170px;
}
@ -342,10 +395,48 @@
.offset11 {
margin-left: 1130px;
}
.thumbnails {
margin-left: -30px;
.row-fluid {
width: 102.56143440326584%;
margin-left: -2.56%;
}
.thumbnails > li {
margin-left: 30px;
.row-fluid [class*="span"] {
float: left;
margin-left: 2.56%;
}
.row-fluid .span1 {
width: 5.832601732615312%;
}
.row-fluid .span2 {
width: 14.16126839928198%;
}
.row-fluid .span3 {
width: 22.489935065948643%;
}
.row-fluid .span4 {
width: 30.818601732615313%;
}
.row-fluid .span5 {
width: 39.14726839928198%;
}
.row-fluid .span6 {
width: 47.47593506594863%;
}
.row-fluid .span7 {
width: 55.8046017326153%;
}
.row-fluid .span8 {
width: 64.13326839928197%;
}
.row-fluid .span9 {
width: 72.46193506594864%;
}
.row-fluid .span10 {
width: 80.7906017326153%;
}
.row-fluid .span11 {
width: 89.11926839928198%;
}
.row-fluid .span12 {
width: 97.44793506594864%;
}
}

View File

@ -126,7 +126,7 @@ a:hover {
margin-left: 20px;
}
.span1 {
width: 60px;
width: 59.99999999999999px;
}
.span2 {
width: 140px;
@ -194,6 +194,50 @@ a:hover {
.offset11 {
margin-left: 900px;
}
.row-fluid {
width: 102.12765957421277%;
margin-left: -2.127659574%;
}
.row-fluid [class*="span"] {
float: left;
margin-left: 2.127659574%;
}
.row-fluid .span1 {
width: 6.249999999619791%;
}
.row-fluid .span2 {
width: 14.58333333211979%;
}
.row-fluid .span3 {
width: 22.91666666461979%;
}
.row-fluid .span4 {
width: 31.24999999711979%;
}
.row-fluid .span5 {
width: 39.58333332961979%;
}
.row-fluid .span6 {
width: 47.91666666211979%;
}
.row-fluid .span7 {
width: 56.24999999461979%;
}
.row-fluid .span8 {
width: 64.58333332711977%;
}
.row-fluid .span9 {
width: 72.91666665961978%;
}
.row-fluid .span10 {
width: 81.24999999211977%;
}
.row-fluid .span11 {
width: 89.58333332461977%;
}
.row-fluid .span12 {
width: 97.91666665711978%;
}
.container {
width: 940px;
margin-left: auto;
@ -207,42 +251,18 @@ a:hover {
.container:after {
clear: both;
}
.fluid-container {
position: relative;
min-width: 940px;
.container-fluid {
padding-left: 20px;
padding-right: 20px;
*zoom: 1;
}
.fluid-container:before, .fluid-container:after {
.container-fluid:before, .container-fluid:after {
display: table;
content: "";
}
.fluid-container:after {
.container-fluid:after {
clear: both;
}
.fluid-sidebar {
width: 220px;
margin: 0 20px 18px;
}
.sidebar-left {
padding-left: 260px;
}
.sidebar-right {
padding-right: 260px;
}
.sidebar-left .fluid-sidebar {
float: left;
margin-left: -240px;
}
.sidebar-right .fluid-sidebar {
float: right;
margin-right: -240px;
}
.fluid-content {
float: left;
width: 100%;
}
p {
margin: 0 0 9px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

View File

@ -124,7 +124,6 @@
<div class="row show-grid">
<div class="span12">12</div>
</div>
<div class="row">
<div class="span4">
<p>The default grid system provided as part of Bootstrap is a <strong>940px-wide, 12-column grid</strong>.</p>

View File

@ -52,7 +52,6 @@
<div class="row show-grid">
<div class="span12">12</div>
</div>
<div class="row">
<div class="span4">
<p>{{_i}}The default grid system provided as part of Bootstrap is a <strong>940px-wide, 12-column grid</strong>.{{/i}}</p>

View File

@ -16,8 +16,13 @@
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<link href="../docs/assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/favicon.ico">
@ -30,98 +35,107 @@
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="fluid-container">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="i-bar"></span>
<span class="i-bar"></span>
<span class="i-bar"></span>
</a>
<a class="brand" href="#">Project name</a>
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="fluid-container sidebar-left">
<div class="fluid-sidebar">
<div class="well side-nav">
<ul class="nav list">
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div>
</div>
<div class="fluid-content">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
<p><a class="btn primary large">Learn more &raquo;</a></p>
</div>
<!-- Example row of columns -->
<div class="row">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
<div class="container-fluid">
<div class="row row-fluid">
<div class="span3">
<div class="well sidebar-nav">
<ul class="nav list">
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn primary large">Learn more &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<div class="row row-fluid">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
<div class="row row-fluid">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<hr>
<hr>
<!-- Example row of columns -->
<div class="row">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<footer>
<p>&copy; Company 2012</p>
</footer>
<hr>
<footer>
<p>&copy; Company 2012</p>
</footer>
</div>
</div>
</div><!--/.fluid-container-->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../js/tests/vendor/jquery.js"></script>
<script src="../js/bootstrap-transition.js"></script>
<script src="../js/bootstrap-collapse.js"></script>
</body>
</html>
</html>

View File

@ -1,14 +1,40 @@
// GRID SYSTEM
// -----------
// To customize the grid system, bring up the variables.less file and change the column count, size, and gutter there
// Default grid sizing
// -------------------
@gridColumns: 12;
@gridColumnWidth: 60px;
@gridGutterWidth: 20px;
@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
@gridTotalWidth: @gridRowWidth;
// Columns and offseting mixins
// ----------------------------
.columns(@columns: 1) {
//width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
width: @gridTotalWidth * ((((@gridGutterWidth+@gridColumnWidth)*@columns)-@gridGutterWidth)/@gridRowWidth);
}
.offset(@columns: 1) {
margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2);
}
// Necessary grid styles for every column to make them appear next to each other horizontally
.gridColumn() {
float: left;
margin-left: @gridGutterWidth;
}
// Grid rows and columns
// ---------------------
.row {
margin-left: @gridGutterWidth * -1;
.clearfix();
}
// Find all .span# classes within .row and give them the necessary properties for grid columns
// (supported by all browsers back to IE7)
// Credit to @dhg for the idea
// Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7, thanks @dhg)
[class*="span"] {
.gridColumn();
}
@ -39,3 +65,42 @@
.offset9 { .offset(9); }
.offset10 { .offset(10); }
.offset11 { .offset(11); }
// FLUID GRID SYSTEM
// -----------------
// This is a very early and limited fluid grid system for now and will not be documented until it's refined in v2.1.
.row-fluid {
@gridColumnWidth: 6.382978723%;
@gridGutterWidth: 2.127659574%;
width: 100% * ((@gridGutterWidth + @gridRowWidth)/@gridRowWidth);
margin-left: 0 - @gridGutterWidth;
// Redeclare the mixins
.gridColumn() {
float: left;
margin-left: @gridGutterWidth;
}
[class*="span"] {
.gridColumn();
}
.fluidColumns(@columns: 1) {
width: @gridTotalWidth * ((((@gridGutterWidth+@gridColumnWidth)*@columns)-@gridGutterWidth)/(@gridRowWidth+@gridGutterWidth));
}
// Redeclare the columns
.span1 { .fluidColumns(1); }
.span2 { .fluidColumns(2); }
.span3 { .fluidColumns(3); }
.span4 { .fluidColumns(4); }
.span5 { .fluidColumns(5); }
.span6 { .fluidColumns(6); }
.span7 { .fluidColumns(7); }
.span8 { .fluidColumns(8); }
.span9 { .fluidColumns(9); }
.span10 { .fluidColumns(10); }
.span11 { .fluidColumns(11); }
.span12 { .fluidColumns(12); }
}

View File

@ -10,34 +10,8 @@
}
// Fluid layouts (left aligned, with sidebar, min- & max-width content)
.fluid-container {
position: relative;
min-width: @siteWidth;
.container-fluid {
padding-left: @gridGutterWidth;
padding-right: @gridGutterWidth;
.clearfix();
}
// Sidebars (left and right options)
.fluid-sidebar {
width: @fluidSidebarWidth;
margin: 0 20px 18px;
}
.sidebar-left { padding-left: @fluidSidebarWidth + @gridGutterWidth * 2; }
.sidebar-right { padding-right: @fluidSidebarWidth + @gridGutterWidth * 2; }
// Float the sidebars accordingly
.sidebar-left .fluid-sidebar {
float: left;
margin-left: (@fluidSidebarWidth + @gridGutterWidth) * -1;
}
.sidebar-right .fluid-sidebar {
float: right;
margin-right: (@fluidSidebarWidth + @gridGutterWidth) * -1;
}
// The main content area
.fluid-content {
float: left;
width: 100%;
}
}

View File

@ -133,31 +133,12 @@
// Site container
// -------------------------
.container-fixed() {
width: @siteWidth;
width: @gridTotalWidth;
margin-left: auto;
margin-right: auto;
.clearfix();
}
// Columns and offseting
// -------------------------
.columns(@columns: 1) {
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}
.offset(@columns: 1) {
margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)) + (@gridGutterWidth * 2);
}
// Necessary grid styles for every column to make them appear next to each other horizontally
.gridColumn() {
float: left;
margin-left: @gridGutterWidth;
}
// makeColumn can be used to mark any element (e.g., .content-primary) as a column without changing markup to .span something
.makeColumn(@columnSpan: 1) {
.gridColumn();
.columns(@columnSpan);
}
// CSS3 PROPERTIES

View File

@ -115,6 +115,10 @@
width: auto;
padding: 0 20px;
}
// Fluid rows
.row-fluid {
width: 100%;
}
// Undo negative margin on rows
.row {
margin-left: 0;
@ -182,6 +186,42 @@
.offset10 { .offset(10); }
.offset11 { .offset(11); }
// FLUID GRID
// ----------
.row-fluid {
@gridColumnWidth: 5.801104972%;
@gridGutterWidth: 2.762430939%;
@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
@gridTotalWidth: @gridRowWidth;
width: 100% * ((@gridGutterWidth + @gridRowWidth)/@gridRowWidth);
margin-left: 0 - @gridGutterWidth;
// Redeclare the mixins
.gridColumn() {
float: left;
margin-left: @gridGutterWidth;
}
[class*="span"] {
.gridColumn();
}
.fluidColumns(@columns: 1) {
width: @gridTotalWidth * ((((@gridGutterWidth+@gridColumnWidth)*@columns)-@gridGutterWidth)/(@gridRowWidth+@gridGutterWidth));
}
// Redeclare the columns
.span1 { .fluidColumns(1); }
.span2 { .fluidColumns(2); }
.span3 { .fluidColumns(3); }
.span4 { .fluidColumns(4); }
.span5 { .fluidColumns(5); }
.span6 { .fluidColumns(6); }
.span7 { .fluidColumns(7); }
.span8 { .fluidColumns(8); }
.span9 { .fluidColumns(9); }
.span10 { .fluidColumns(10); }
.span11 { .fluidColumns(11); }
.span12 { .fluidColumns(12); }
}
}
@ -198,7 +238,7 @@
// Unfix the navbar
.navbar-fixed-top {
position: static;
margin-bottom: @baseLineHeight * 2;
margin-bottom: @baseLineHeight;
}
.navbar-inner {
padding: 5px;
@ -314,6 +354,14 @@
@gridGutterWidth: 30px;
@siteWidth: 1170px;
// Thumbnails
.thumbnails {
margin-left: @gridGutterWidth * -1;
}
.thumbnails > li {
margin-left: @gridGutterWidth;
}
// Bring grid mixins to recalculate widths
.columns(@columns: 1) {
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
@ -358,12 +406,41 @@
.offset10 { .offset(10); }
.offset11 { .offset(11); }
// Thumbnails
.thumbnails {
margin-left: @gridGutterWidth * -1;
}
.thumbnails > li {
margin-left: @gridGutterWidth;
}
// FLUID GRID
// ----------
.row-fluid {
@gridColumnWidth: 5.982%;
@gridGutterWidth: 2.56%;
@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
@gridTotalWidth: @gridRowWidth;
width: 100% * ((@gridGutterWidth + @gridRowWidth)/@gridRowWidth);
margin-left: 0 - @gridGutterWidth;
// Redeclare the mixins
.gridColumn() {
float: left;
margin-left: @gridGutterWidth;
}
[class*="span"] {
.gridColumn();
}
.fluidColumns(@columns: 1) {
width: @gridTotalWidth * ((((@gridGutterWidth+@gridColumnWidth)*@columns)-@gridGutterWidth)/(@gridRowWidth+@gridGutterWidth));
}
// Redeclare the columns
.span1 { .fluidColumns(1); }
.span2 { .fluidColumns(2); }
.span3 { .fluidColumns(3); }
.span4 { .fluidColumns(4); }
.span5 { .fluidColumns(5); }
.span6 { .fluidColumns(6); }
.span7 { .fluidColumns(7); }
.span8 { .fluidColumns(8); }
.span9 { .fluidColumns(9); }
.span10 { .fluidColumns(10); }
.span11 { .fluidColumns(11); }
.span12 { .fluidColumns(12); }
}
}

View File

@ -30,15 +30,6 @@
@pink: #c3325f;
@purple: #7a43b6;
// Grid system
// Modify the grid styles in mixins.less
@gridColumns: 12;
@gridColumnWidth: 60px;
@gridGutterWidth: 20px;
@siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
// Fluid width sidebar
@fluidSidebarWidth: 220px;
// Typography
@baseFontSize: 13px;
@baseFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;