-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy path_position.scss
More file actions
102 lines (87 loc) · 2.57 KB
/
Copy path_position.scss
File metadata and controls
102 lines (87 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Foundation for Sites
// https://get.foundation
// Licensed under MIT Open Source
////
/// @group grid
////
@use "sass:math";
/// Reposition a column.
///
/// @param {Number|Keyword} $position - It can be:
/// * A number: The column will move equal to the width of the column count
/// specified. A positive number will push the column to the right, while
/// a negative number will pull it to the left.
/// * `center`: Column will be centered
/// * `auto`: Column will be pushed to the left (or to the right for the last column).
@mixin grid-column-position($position) {
// Auto positioning
@if $position == auto {
&, &:last-child:not(:first-child) {
float: $global-left;
clear: none;
}
// Last column alignment
@if $grid-column-align-edge {
&:last-child:not(:first-child) {
float: $global-right;
}
}
}
// Push/pull
@else if type-of($position) == 'number' {
$offset: math.percentage(divide($position, $grid-column-count));
position: relative;
#{$global-left}: $offset;
}
// Center positioning
@else if $position == center {
margin-left: auto;
margin-right: auto;
&, &:last-child:not(:first-child) {
float: none;
clear: both;
}
}
@else {
@warn 'Wrong syntax for grid-column-position(). Enter a positive or negative number, "center" or "auto".';
}
}
/// Reset a position definition.
@mixin grid-column-unposition {
position: static;
margin-right: 0;
margin-left: 0;
@include grid-column-position(auto);
}
/// Offsets a column to the right by `$n` columns.
/// @param {Number|List} $n - Width to offset by. You can pass in any value accepted by the `grid-column()` mixin, such as `6`, `50%`, or `1 of 2`.
@mixin grid-column-offset($n) {
margin-#{$global-left}: grid-column($n);
}
/// Disable the default behavior of the last column in a row aligning to the opposite edge.
@mixin grid-column-end {
// This extra specificity is required for the property to be applied
&:last-child:last-child {
float: $global-left;
}
}
/// Shorthand for `grid-column-position()`.
/// @alias grid-column-position
@mixin grid-col-pos($position) {
@include grid-column-position($position);
}
/// Shorthand for `grid-column-unposition()`.
/// @alias grid-column-unposition
@mixin grid-col-unpos {
@include grid-column-unposition;
}
/// Shorthand for `grid-column-offset()`.
/// @alias grid-column-offset
@mixin grid-col-off($n) {
@include grid-column-offset($n);
}
/// Shorthand for `grid-column-end()`.
/// @alias grid-column-end
@mixin grid-col-end {
@include grid-column-end;
}