Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
76d6b17f
Commit
76d6b17f
authored
Dec 11, 2014
by
Gleb Mazovetskiy
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from twbs/grid-framework-refactor
Refactor grid_framework
parents
63d4423f
5fefe06c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
58 deletions
+48
-58
scss/_variables.scss
scss/_variables.scss
+1
-1
scss/mixins/_grid-framework.scss
scss/mixins/_grid-framework.scss
+47
-57
No files found.
scss/_variables.scss
View file @
76d6b17f
...
@@ -294,7 +294,7 @@ $screen-xs-max: ($screen-sm-min - .1);
...
@@ -294,7 +294,7 @@ $screen-xs-max: ($screen-sm-min - .1);
//== Grid system
//== Grid system
//
//
//## Define your custom responsive grid.
//## Define your custom responsive grid.
$grid-breakpoints
:
(
xs
sm
md
lg
xl
);
//** Number of columns in the grid.
//** Number of columns in the grid.
$grid-columns
:
12
;
$grid-columns
:
12
;
//** Padding between columns. Gets divided in half for the left and right.
//** Padding between columns. Gets divided in half for the left and right.
...
...
scss/mixins/_grid-framework.scss
View file @
76d6b17f
...
@@ -3,79 +3,69 @@
...
@@ -3,79 +3,69 @@
// Used only by Bootstrap to generate the correct number of grid classes given
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `$grid-columns`.
// any value of `$grid-columns`.
// [converter] This is defined recursively in LESS, but Sass supports real loops
// Common properties for all breakpoints
@mixin
make-grid-columns
(
$i
:
1
,
$list
:
".col-xs-
#{
$i
}
, .col-sm-
#{
$i
}
, .col-md-
#{
$i
}
, .col-lg-
#{
$i
}
, .col-xl-
#{
$i
}
"
)
{
@mixin
make-grid-columns
(
$columns
:
$grid-columns
,
$breakpoints
:
$grid-breakpoints
)
{
@for
$i
from
(
1
+
1
)
through
$grid-columns
{
%grid-column
{
$list
:
"
#{
$list
}
, .col-xs-
#{
$i
}
, .col-sm-
#{
$i
}
, .col-md-
#{
$i
}
, .col-lg-
#{
$i
}
, .col-xl-
#{
$i
}
"
;
}
#{
$list
}
{
position
:
relative
;
position
:
relative
;
// Prevent columns from collapsing when empty
// Prevent columns from collapsing when empty
min-height
:
1px
;
min-height
:
1px
;
// Inner gutter via padding
// Inner gutter via padding
padding-left
:
(
$grid-gutter-width
/
2
);
padding-left
:
(
$grid-gutter-width
/
2
);
padding-right
:
(
$grid-gutter-width
/
2
);
padding-right
:
(
$grid-gutter-width
/
2
);
}
}
}
@for
$i
from
1
through
$columns
{
@each
$breakpoint
in
$breakpoints
{
.col-
#{
$breakpoint
}
-
#{
$i
}
{
// [converter] This is defined recursively in LESS, but Sass supports real loops
@extend
%grid-column
;
@mixin
float-grid-columns
(
$class
,
$i
:
1
,
$list
:
".col-
#{
$class
}
-
#{
$i
}
"
)
{
}
@for
$i
from
(
1
+
1
)
through
$grid-columns
{
}
$list
:
"
#{
$list
}
, .col-
#{
$class
}
-
#{
$i
}
"
;
}
#{
$list
}
{
float
:
left
;
}
}
}
}
// Breakpoint-specific properties
@mixin
calc-grid-column
(
$index
,
$class
,
$type
)
{
@mixin
make-grid
(
$breakpoint
,
$columns
:
$grid-columns
)
{
@if
(
$type
==
width
)
and
(
$index
>
0
)
{
// Work around cross-media @extend (https://github.com/sass/sass/issues/1050)
.col-
#{
$class
}
-
#{
$index
}
{
%grid-column-float-
#{
$breakpoint
}
{
width
:
percentage
((
$index
/
$grid-columns
));
float
:
left
;
}
}
@if
(
$type
==
push
)
and
(
$index
>
0
)
{
.col-
#{
$class
}
-push-
#{
$index
}
{
left
:
percentage
((
$index
/
$grid-columns
));
}
}
@if
(
$type
==
push
)
and
(
$index
==
0
)
{
.col-
#{
$class
}
-push-0
{
left
:
auto
;
}
}
@if
(
$type
==
pull
)
and
(
$index
>
0
)
{
.col-
#{
$class
}
-pull-
#{
$index
}
{
right
:
percentage
((
$index
/
$grid-columns
));
}
}
}
@if
(
$type
==
pull
)
and
(
$index
==
0
)
{
@for
$i
from
1
through
$columns
{
.col-
#{
$class
}
-pull-0
{
.col-
#{
$breakpoint
}
-
#{
$i
}
{
right
:
auto
;
@extend
%grid-column-float-
#{
$breakpoint
}
;
@include
grid-column-width
(
$i
,
$columns
);
}
}
}
}
@if
(
$type
==
offset
)
{
@each
$modifier
in
(
pull
,
push
,
offset
)
{
.col-
#{
$class
}
-offset-
#{
$index
}
{
@for
$i
from
0
through
$columns
{
margin-left
:
percentage
((
$index
/
$grid-columns
));
.col-
#{
$breakpoint
}
-
#{
$modifier
}
-
#{
$i
}
{
@include
grid-column-modifier
(
$modifier
,
$i
,
$columns
)
}
}
}
}
}
}
}
// [converter] This is defined recursively in LESS, but Sass supports real loops
@mixin
grid-column-width
(
$index
,
$columns
)
{
@mixin
loop-grid-columns
(
$columns
,
$class
,
$type
)
{
width
:
percentage
(
$index
/
$columns
);
@for
$i
from
0
through
$columns
{
}
@include
calc-grid-column
(
$i
,
$class
,
$type
);
}
@mixin
grid-column-push
(
$index
,
$columns
)
{
left
:
if
(
$index
>
0
,
percentage
(
$index
/
$columns
)
,
auto
);
}
@mixin
grid-column-pull
(
$index
,
$columns
)
{
right
:
if
(
$index
>
0
,
percentage
(
$index
/
$columns
)
,
auto
);
}
}
@mixin
grid-column-offset
(
$index
,
$columns
)
{
margin-left
:
percentage
(
$index
/
$columns
);
}
// Create grid for specific class
// Work around the lack of dynamic mixin @include support (https://github.com/sass/sass/issues/626)
@mixin
make-grid
(
$class
)
{
@mixin
grid-column-modifier
(
$type
,
$index
,
$columns
)
{
@include
float-grid-columns
(
$class
);
@if
$type
==
push
{
@include
loop-grid-columns
(
$grid-columns
,
$class
,
width
);
@include
grid-column-push
(
$index
,
$columns
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
pull
);
}
@else
if
$type
==
pull
{
@include
loop-grid-columns
(
$grid-columns
,
$class
,
push
);
@include
grid-column-pull
(
$index
,
$columns
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
offset
);
}
@else
if
$type
==
offset
{
}
@include
grid-column-offset
(
$index
,
$columns
);
\ No newline at end of file
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment