From c814ad18333d7deefd3bff5446b02d6933f49f02 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 11 Oct 2013 22:00:37 -0700 Subject: Combine separate efforts for grid mixins into one, cleanup and reorganize --- less/grid.less | 297 +++++---------------------------------------------------- 1 file changed, 22 insertions(+), 275 deletions(-) (limited to 'less/grid.less') diff --git a/less/grid.less b/less/grid.less index 39f1049b6..67e78f760 100644 --- a/less/grid.less +++ b/less/grid.less @@ -2,7 +2,6 @@ // Grid system // -------------------------------------------------- - // Set the container width, and override it for fixed navbars in media queries .container { .container-fixed(); @@ -14,61 +13,7 @@ } // Common styles for small and large grid columns -.col-xs-1, -.col-xs-2, -.col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, -.col-xs-9, -.col-xs-10, -.col-xs-11, -.col-xs-12, -.col-sm-1, -.col-sm-2, -.col-sm-3, -.col-sm-4, -.col-sm-5, -.col-sm-6, -.col-sm-7, -.col-sm-8, -.col-sm-9, -.col-sm-10, -.col-sm-11, -.col-sm-12, -.col-md-1, -.col-md-2, -.col-md-3, -.col-md-4, -.col-md-5, -.col-md-6, -.col-md-7, -.col-md-8, -.col-md-9, -.col-md-10, -.col-md-11, -.col-md-12, -.col-lg-1, -.col-lg-2, -.col-lg-3, -.col-lg-4, -.col-lg-5, -.col-lg-6, -.col-lg-7, -.col-lg-8, -.col-lg-9, -.col-lg-10, -.col-lg-11, -.col-lg-12 { - position: relative; - // Prevent columns from collapsing when empty - min-height: 1px; - // Inner gutter via padding - padding-left: (@grid-gutter-width / 2); - padding-right: (@grid-gutter-width / 2); -} +.make-grid-columns(); // Extra small grid @@ -79,31 +24,11 @@ // Note that `.col-xs-12` doesn't get floated on purpose--there's no need since // it's full-width. -.col-xs-1, -.col-xs-2, -.col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, -.col-xs-9, -.col-xs-10, -.col-xs-11 { - float: left; -} -.col-xs-1 { width: percentage((1 / @grid-columns)); } -.col-xs-2 { width: percentage((2 / @grid-columns)); } -.col-xs-3 { width: percentage((3 / @grid-columns)); } -.col-xs-4 { width: percentage((4 / @grid-columns)); } -.col-xs-5 { width: percentage((5 / @grid-columns)); } -.col-xs-6 { width: percentage((6 / @grid-columns)); } -.col-xs-7 { width: percentage((7 / @grid-columns)); } -.col-xs-8 { width: percentage((8 / @grid-columns)); } -.col-xs-9 { width: percentage((9 / @grid-columns)); } -.col-xs-10 { width: percentage((10/ @grid-columns)); } -.col-xs-11 { width: percentage((11/ @grid-columns)); } -.col-xs-12 { width: 100%; } +.make-grid-columns-float(xs); +.make-grid(@grid-columns, xs, width); +.make-grid(@grid-columns, xs, pull); +.make-grid(@grid-columns, xs, push); +.make-grid(@grid-columns, xs, offset); // Small grid @@ -119,69 +44,11 @@ width: @container-sm; } - .col-sm-1, - .col-sm-2, - .col-sm-3, - .col-sm-4, - .col-sm-5, - .col-sm-6, - .col-sm-7, - .col-sm-8, - .col-sm-9, - .col-sm-10, - .col-sm-11 { - float: left; - } - .col-sm-1 { width: percentage((1 / @grid-columns)); } - .col-sm-2 { width: percentage((2 / @grid-columns)); } - .col-sm-3 { width: percentage((3 / @grid-columns)); } - .col-sm-4 { width: percentage((4 / @grid-columns)); } - .col-sm-5 { width: percentage((5 / @grid-columns)); } - .col-sm-6 { width: percentage((6 / @grid-columns)); } - .col-sm-7 { width: percentage((7 / @grid-columns)); } - .col-sm-8 { width: percentage((8 / @grid-columns)); } - .col-sm-9 { width: percentage((9 / @grid-columns)); } - .col-sm-10 { width: percentage((10/ @grid-columns)); } - .col-sm-11 { width: percentage((11/ @grid-columns)); } - .col-sm-12 { width: 100%; } - - // Push and pull columns for source order changes - .col-sm-push-1 { left: percentage((1 / @grid-columns)); } - .col-sm-push-2 { left: percentage((2 / @grid-columns)); } - .col-sm-push-3 { left: percentage((3 / @grid-columns)); } - .col-sm-push-4 { left: percentage((4 / @grid-columns)); } - .col-sm-push-5 { left: percentage((5 / @grid-columns)); } - .col-sm-push-6 { left: percentage((6 / @grid-columns)); } - .col-sm-push-7 { left: percentage((7 / @grid-columns)); } - .col-sm-push-8 { left: percentage((8 / @grid-columns)); } - .col-sm-push-9 { left: percentage((9 / @grid-columns)); } - .col-sm-push-10 { left: percentage((10/ @grid-columns)); } - .col-sm-push-11 { left: percentage((11/ @grid-columns)); } - - .col-sm-pull-1 { right: percentage((1 / @grid-columns)); } - .col-sm-pull-2 { right: percentage((2 / @grid-columns)); } - .col-sm-pull-3 { right: percentage((3 / @grid-columns)); } - .col-sm-pull-4 { right: percentage((4 / @grid-columns)); } - .col-sm-pull-5 { right: percentage((5 / @grid-columns)); } - .col-sm-pull-6 { right: percentage((6 / @grid-columns)); } - .col-sm-pull-7 { right: percentage((7 / @grid-columns)); } - .col-sm-pull-8 { right: percentage((8 / @grid-columns)); } - .col-sm-pull-9 { right: percentage((9 / @grid-columns)); } - .col-sm-pull-10 { right: percentage((10/ @grid-columns)); } - .col-sm-pull-11 { right: percentage((11/ @grid-columns)); } - - // Offsets - .col-sm-offset-1 { margin-left: percentage((1 / @grid-columns)); } - .col-sm-offset-2 { margin-left: percentage((2 / @grid-columns)); } - .col-sm-offset-3 { margin-left: percentage((3 / @grid-columns)); } - .col-sm-offset-4 { margin-left: percentage((4 / @grid-columns)); } - .col-sm-offset-5 { margin-left: percentage((5 / @grid-columns)); } - .col-sm-offset-6 { margin-left: percentage((6 / @grid-columns)); } - .col-sm-offset-7 { margin-left: percentage((7 / @grid-columns)); } - .col-sm-offset-8 { margin-left: percentage((8 / @grid-columns)); } - .col-sm-offset-9 { margin-left: percentage((9 / @grid-columns)); } - .col-sm-offset-10 { margin-left: percentage((10/ @grid-columns)); } - .col-sm-offset-11 { margin-left: percentage((11/ @grid-columns)); } + .make-grid-columns-float(sm); + .make-grid(@grid-columns, sm, width); + .make-grid(@grid-columns, sm, pull); + .make-grid(@grid-columns, sm, push); + .make-grid(@grid-columns, sm, offset); } @@ -196,72 +63,12 @@ .container { width: @container-md; } - .col-md-1, - .col-md-2, - .col-md-3, - .col-md-4, - .col-md-5, - .col-md-6, - .col-md-7, - .col-md-8, - .col-md-9, - .col-md-10, - .col-md-11 { - float: left; - } - .col-md-1 { width: percentage((1 / @grid-columns)); } - .col-md-2 { width: percentage((2 / @grid-columns)); } - .col-md-3 { width: percentage((3 / @grid-columns)); } - .col-md-4 { width: percentage((4 / @grid-columns)); } - .col-md-5 { width: percentage((5 / @grid-columns)); } - .col-md-6 { width: percentage((6 / @grid-columns)); } - .col-md-7 { width: percentage((7 / @grid-columns)); } - .col-md-8 { width: percentage((8 / @grid-columns)); } - .col-md-9 { width: percentage((9 / @grid-columns)); } - .col-md-10 { width: percentage((10/ @grid-columns)); } - .col-md-11 { width: percentage((11/ @grid-columns)); } - .col-md-12 { width: 100%; } - // Push and pull columns for source order changes - .col-md-push-0 { left: auto; } - .col-md-push-1 { left: percentage((1 / @grid-columns)); } - .col-md-push-2 { left: percentage((2 / @grid-columns)); } - .col-md-push-3 { left: percentage((3 / @grid-columns)); } - .col-md-push-4 { left: percentage((4 / @grid-columns)); } - .col-md-push-5 { left: percentage((5 / @grid-columns)); } - .col-md-push-6 { left: percentage((6 / @grid-columns)); } - .col-md-push-7 { left: percentage((7 / @grid-columns)); } - .col-md-push-8 { left: percentage((8 / @grid-columns)); } - .col-md-push-9 { left: percentage((9 / @grid-columns)); } - .col-md-push-10 { left: percentage((10/ @grid-columns)); } - .col-md-push-11 { left: percentage((11/ @grid-columns)); } - - .col-md-pull-0 { right: auto; } - .col-md-pull-1 { right: percentage((1 / @grid-columns)); } - .col-md-pull-2 { right: percentage((2 / @grid-columns)); } - .col-md-pull-3 { right: percentage((3 / @grid-columns)); } - .col-md-pull-4 { right: percentage((4 / @grid-columns)); } - .col-md-pull-5 { right: percentage((5 / @grid-columns)); } - .col-md-pull-6 { right: percentage((6 / @grid-columns)); } - .col-md-pull-7 { right: percentage((7 / @grid-columns)); } - .col-md-pull-8 { right: percentage((8 / @grid-columns)); } - .col-md-pull-9 { right: percentage((9 / @grid-columns)); } - .col-md-pull-10 { right: percentage((10/ @grid-columns)); } - .col-md-pull-11 { right: percentage((11/ @grid-columns)); } - - // Offsets - .col-md-offset-0 { margin-left: 0; } - .col-md-offset-1 { margin-left: percentage((1 / @grid-columns)); } - .col-md-offset-2 { margin-left: percentage((2 / @grid-columns)); } - .col-md-offset-3 { margin-left: percentage((3 / @grid-columns)); } - .col-md-offset-4 { margin-left: percentage((4 / @grid-columns)); } - .col-md-offset-5 { margin-left: percentage((5 / @grid-columns)); } - .col-md-offset-6 { margin-left: percentage((6 / @grid-columns)); } - .col-md-offset-7 { margin-left: percentage((7 / @grid-columns)); } - .col-md-offset-8 { margin-left: percentage((8 / @grid-columns)); } - .col-md-offset-9 { margin-left: percentage((9 / @grid-columns)); } - .col-md-offset-10 { margin-left: percentage((10/ @grid-columns)); } - .col-md-offset-11 { margin-left: percentage((11/ @grid-columns)); } + .make-grid-columns-float(md); + .make-grid(@grid-columns, md, width); + .make-grid(@grid-columns, md, pull); + .make-grid(@grid-columns, md, push); + .make-grid(@grid-columns, md, offset); } @@ -277,70 +84,10 @@ width: @container-lg; } - .col-lg-1, - .col-lg-2, - .col-lg-3, - .col-lg-4, - .col-lg-5, - .col-lg-6, - .col-lg-7, - .col-lg-8, - .col-lg-9, - .col-lg-10, - .col-lg-11 { - float: left; - } - .col-lg-1 { width: percentage((1 / @grid-columns)); } - .col-lg-2 { width: percentage((2 / @grid-columns)); } - .col-lg-3 { width: percentage((3 / @grid-columns)); } - .col-lg-4 { width: percentage((4 / @grid-columns)); } - .col-lg-5 { width: percentage((5 / @grid-columns)); } - .col-lg-6 { width: percentage((6 / @grid-columns)); } - .col-lg-7 { width: percentage((7 / @grid-columns)); } - .col-lg-8 { width: percentage((8 / @grid-columns)); } - .col-lg-9 { width: percentage((9 / @grid-columns)); } - .col-lg-10 { width: percentage((10/ @grid-columns)); } - .col-lg-11 { width: percentage((11/ @grid-columns)); } - .col-lg-12 { width: 100%; } - - // Push and pull columns for source order changes - .col-lg-push-0 { left: auto; } - .col-lg-push-1 { left: percentage((1 / @grid-columns)); } - .col-lg-push-2 { left: percentage((2 / @grid-columns)); } - .col-lg-push-3 { left: percentage((3 / @grid-columns)); } - .col-lg-push-4 { left: percentage((4 / @grid-columns)); } - .col-lg-push-5 { left: percentage((5 / @grid-columns)); } - .col-lg-push-6 { left: percentage((6 / @grid-columns)); } - .col-lg-push-7 { left: percentage((7 / @grid-columns)); } - .col-lg-push-8 { left: percentage((8 / @grid-columns)); } - .col-lg-push-9 { left: percentage((9 / @grid-columns)); } - .col-lg-push-10 { left: percentage((10/ @grid-columns)); } - .col-lg-push-11 { left: percentage((11/ @grid-columns)); } - - .col-lg-pull-0 { right: auto; } - .col-lg-pull-1 { right: percentage((1 / @grid-columns)); } - .col-lg-pull-2 { right: percentage((2 / @grid-columns)); } - .col-lg-pull-3 { right: percentage((3 / @grid-columns)); } - .col-lg-pull-4 { right: percentage((4 / @grid-columns)); } - .col-lg-pull-5 { right: percentage((5 / @grid-columns)); } - .col-lg-pull-6 { right: percentage((6 / @grid-columns)); } - .col-lg-pull-7 { right: percentage((7 / @grid-columns)); } - .col-lg-pull-8 { right: percentage((8 / @grid-columns)); } - .col-lg-pull-9 { right: percentage((9 / @grid-columns)); } - .col-lg-pull-10 { right: percentage((10/ @grid-columns)); } - .col-lg-pull-11 { right: percentage((11/ @grid-columns)); } - - // Offsets - .col-lg-offset-0 { margin-left: 0; } - .col-lg-offset-1 { margin-left: percentage((1 / @grid-columns)); } - .col-lg-offset-2 { margin-left: percentage((2 / @grid-columns)); } - .col-lg-offset-3 { margin-left: percentage((3 / @grid-columns)); } - .col-lg-offset-4 { margin-left: percentage((4 / @grid-columns)); } - .col-lg-offset-5 { margin-left: percentage((5 / @grid-columns)); } - .col-lg-offset-6 { margin-left: percentage((6 / @grid-columns)); } - .col-lg-offset-7 { margin-left: percentage((7 / @grid-columns)); } - .col-lg-offset-8 { margin-left: percentage((8 / @grid-columns)); } - .col-lg-offset-9 { margin-left: percentage((9 / @grid-columns)); } - .col-lg-offset-10 { margin-left: percentage((10/ @grid-columns)); } - .col-lg-offset-11 { margin-left: percentage((11/ @grid-columns)); } + .make-grid-columns-float(lg); + .make-grid(@grid-columns, lg, width); + .make-grid(@grid-columns, lg, pull); + .make-grid(@grid-columns, lg, push); + .make-grid(@grid-columns, lg, offset); } + -- cgit v1.2.3 From 283c86db38df3c9273749cdd0c401e06a4e66c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatan=20Vasovi=C4=87?= Date: Sun, 17 Nov 2013 21:15:25 +0100 Subject: There are xs-offsets, -pushes and -pulls! --- less/grid.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'less/grid.less') diff --git a/less/grid.less b/less/grid.less index 67e78f760..8f8794339 100644 --- a/less/grid.less +++ b/less/grid.less @@ -18,8 +18,8 @@ // Extra small grid // -// Grid classes for extra small devices like smartphones. No offset, push, or -// pull classes are present here due to the size of the target. +// Columns, offsets, pushes, and pulls for extra small devices like +// smartphones. // // Note that `.col-xs-12` doesn't get floated on purpose--there's no need since // it's full-width. -- cgit v1.2.3 From 9d939080e6536277ec47d19e113bff7376489ff9 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 28 Nov 2013 14:22:31 -0800 Subject: Fixes #10483 and #10357: Make .container mixin-friendly by moving the width declarations within one class --- less/grid.less | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'less/grid.less') diff --git a/less/grid.less b/less/grid.less index 67e78f760..329f68bd3 100644 --- a/less/grid.less +++ b/less/grid.less @@ -5,6 +5,16 @@ // Set the container width, and override it for fixed navbars in media queries .container { .container-fixed(); + + @media (min-width: @screen-sm) { + width: @container-sm; + } + @media (min-width: @screen-md) { + width: @container-md; + } + @media (min-width: @screen-lg-min) { + width: @container-lg; + } } // mobile first defaults @@ -40,10 +50,6 @@ // it's full-width. @media (min-width: @screen-sm-min) { - .container { - width: @container-sm; - } - .make-grid-columns-float(sm); .make-grid(@grid-columns, sm, width); .make-grid(@grid-columns, sm, pull); @@ -60,10 +66,6 @@ // it's full-width. @media (min-width: @screen-md-min) { - .container { - width: @container-md; - } - .make-grid-columns-float(md); .make-grid(@grid-columns, md, width); .make-grid(@grid-columns, md, pull); @@ -80,10 +82,6 @@ // it's full-width. @media (min-width: @screen-lg-min) { - .container { - width: @container-lg; - } - .make-grid-columns-float(lg); .make-grid(@grid-columns, lg, width); .make-grid(@grid-columns, lg, pull); -- cgit v1.2.3 From 702ad4c3025c8db0ec482e5eccd339cf1e6c2a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatan=20Vasovi=C4=87?= Date: Fri, 29 Nov 2013 11:37:06 +0100 Subject: Remove redundant comments --- less/grid.less | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'less/grid.less') diff --git a/less/grid.less b/less/grid.less index 329f68bd3..e1f134e6d 100644 --- a/less/grid.less +++ b/less/grid.less @@ -30,9 +30,6 @@ // // Grid classes for extra small devices like smartphones. No offset, push, or // pull classes are present here due to the size of the target. -// -// Note that `.col-xs-12` doesn't get floated on purpose--there's no need since -// it's full-width. .make-grid-columns-float(xs); .make-grid(@grid-columns, xs, width); @@ -45,9 +42,6 @@ // // Columns, offsets, pushes, and pulls for the small device range, from phones // to tablets. -// -// Note that `.col-sm-12` doesn't get floated on purpose--there's no need since -// it's full-width. @media (min-width: @screen-sm-min) { .make-grid-columns-float(sm); @@ -61,9 +55,6 @@ // Medium grid // // Columns, offsets, pushes, and pulls for the desktop device range. -// -// Note that `.col-md-12` doesn't get floated on purpose--there's no need since -// it's full-width. @media (min-width: @screen-md-min) { .make-grid-columns-float(md); @@ -77,9 +68,6 @@ // Large grid // // Columns, offsets, pushes, and pulls for the large desktop device range. -// -// Note that `.col-lg-12` doesn't get floated on purpose--there's no need since -// it's full-width. @media (min-width: @screen-lg-min) { .make-grid-columns-float(lg); -- cgit v1.2.3 From 6273604601c58284f49b38ae4e52533b9689437c Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 7 Dec 2013 20:52:51 -0800 Subject: Add .container-fluid variation for full-width containers and layouts /cc #10711 #9862 --- less/grid.less | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'less/grid.less') diff --git a/less/grid.less b/less/grid.less index 279d80368..dfae6999b 100644 --- a/less/grid.less +++ b/less/grid.less @@ -2,7 +2,11 @@ // Grid system // -------------------------------------------------- -// Set the container width, and override it for fixed navbars in media queries + +// Container widths +// +// Set the container width, and override it for fixed navbars in media queries. + .container { .container-fixed(); @@ -17,12 +21,30 @@ } } -// mobile first defaults + +// Fluid container +// +// Utilizes the mixin meant for fixed width containers, but without any defined +// width for fluid, full width layouts. + +.container-fluid { + .container-fixed(); +} + + +// Row +// +// Rows contain and clear the floats of your columns. + .row { .make-row(); } + +// Columns +// // Common styles for small and large grid columns + .make-grid-columns(); @@ -76,4 +98,3 @@ .make-grid(@grid-columns, lg, push); .make-grid(@grid-columns, lg, offset); } - -- cgit v1.2.3