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
f7e103a6
Commit
f7e103a6
authored
Dec 11, 2014
by
Mark Otto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v4' of
https://github.com/twbs/derpstrap
into v4
parents
0e371ddf
76d6b17f
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 @
f7e103a6
...
...
@@ -294,7 +294,7 @@ $screen-xs-max: ($screen-sm-min - .1);
//== Grid system
//
//## Define your custom responsive grid.
$grid-breakpoints
:
(
xs
sm
md
lg
xl
);
//** Number of columns in the grid.
$grid-columns
:
12
;
//** Padding between columns. Gets divided in half for the left and right.
...
...
scss/mixins/_grid-framework.scss
View file @
f7e103a6
...
...
@@ -3,79 +3,69 @@
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `$grid-columns`.
// [converter] This is defined recursively in LESS, but Sass supports real loops
@mixin
make-grid-columns
(
$i
:
1
,
$list
:
".col-xs-
#{
$i
}
, .col-sm-
#{
$i
}
, .col-md-
#{
$i
}
, .col-lg-
#{
$i
}
, .col-xl-
#{
$i
}
"
)
{
@for
$i
from
(
1
+
1
)
through
$grid-columns
{
$list
:
"
#{
$list
}
, .col-xs-
#{
$i
}
, .col-sm-
#{
$i
}
, .col-md-
#{
$i
}
, .col-lg-
#{
$i
}
, .col-xl-
#{
$i
}
"
;
}
#{
$list
}
{
// Common properties for all breakpoints
@mixin
make-grid-columns
(
$columns
:
$grid-columns
,
$breakpoints
:
$grid-breakpoints
)
{
%grid-column
{
position
:
relative
;
// Prevent columns from collapsing when empty
min-height
:
1px
;
// Inner gutter via padding
padding-left
:
(
$grid-gutter-width
/
2
);
padding-left
:
(
$grid-gutter-width
/
2
);
padding-right
:
(
$grid-gutter-width
/
2
);
}
}
// [converter] This is defined recursively in LESS, but Sass supports real loops
@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
;
@for
$i
from
1
through
$columns
{
@each
$breakpoint
in
$breakpoints
{
.col-
#{
$breakpoint
}
-
#{
$i
}
{
@extend
%grid-column
;
}
}
}
}
@mixin
calc-grid-column
(
$index
,
$class
,
$type
)
{
@if
(
$type
==
width
)
and
(
$index
>
0
)
{
.col-
#{
$class
}
-
#{
$index
}
{
width
:
percentage
((
$index
/
$grid-columns
));
}
}
@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
));
}
// Breakpoint-specific properties
@mixin
make-grid
(
$breakpoint
,
$columns
:
$grid-columns
)
{
// Work around cross-media @extend (https://github.com/sass/sass/issues/1050)
%grid-column-float-
#{
$breakpoint
}
{
float
:
left
;
}
@if
(
$type
==
pull
)
and
(
$index
==
0
)
{
.col-
#{
$class
}
-pull-0
{
right
:
auto
;
@for
$i
from
1
through
$columns
{
.col-
#{
$breakpoint
}
-
#{
$i
}
{
@extend
%grid-column-float-
#{
$breakpoint
}
;
@include
grid-column-width
(
$i
,
$columns
);
}
}
@if
(
$type
==
offset
)
{
.col-
#{
$class
}
-offset-
#{
$index
}
{
margin-left
:
percentage
((
$index
/
$grid-columns
));
@each
$modifier
in
(
pull
,
push
,
offset
)
{
@for
$i
from
0
through
$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
loop-grid-columns
(
$columns
,
$class
,
$type
)
{
@for
$i
from
0
through
$columns
{
@include
calc-grid-column
(
$i
,
$class
,
$type
);
}
@mixin
grid-column-width
(
$index
,
$columns
)
{
width
:
percentage
(
$index
/
$columns
);
}
@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
@mixin
make-grid
(
$class
)
{
@include
float-grid-columns
(
$class
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
width
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
pull
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
push
);
@include
loop-grid-columns
(
$grid-columns
,
$class
,
offset
);
}
\ No newline at end of file
// Work around the lack of dynamic mixin @include support (https://github.com/sass/sass/issues/626)
@mixin
grid-column-modifier
(
$type
,
$index
,
$columns
)
{
@if
$type
==
push
{
@include
grid-column-push
(
$index
,
$columns
);
}
@else
if
$type
==
pull
{
@include
grid-column-pull
(
$index
,
$columns
);
}
@else
if
$type
==
offset
{
@include
grid-column-offset
(
$index
,
$columns
);
}
}
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