-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathragrid.scss
149 lines (139 loc) · 2.9 KB
/
ragrid.scss
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// shared styles for columns and rows
// yes it's a general namespace, how many othe grids are you importing?
// it reads so nice in the HTML and CSS right? =)
[grid] {
display: flex;
flex-wrap: wrap;
// https://developer.mozilla.org/en-US/docs/Web/CSS/contain
contain: layout;
&[order~="reverse"] {
flex-direction: row-reverse;
}
/*
ALIGN
- Horizontal: Left, Center, Right
- Vertical: Top, Center, Bottom
*/
&[horizontally-aligned~="left"] {
justify-content: flex-start;
}
&[horizontally-aligned~="center"] {
justify-content: center;
}
&[horizontally-aligned~="right"] {
justify-content: flex-end;
}
&[vertically-aligned~="top"] {
align-items: flex-start;
}
&[vertically-aligned~="center"] {
align-items: center;
}
&[vertically-aligned~="bottom"] {
align-items: flex-end;
}
&[vertically-aligned~="baseline"] {
align-items: baseline;
}
/*
DISTRIBUTE
- Horizontal: Left, Center, Right
- Vertical: Top, Center, Bottom
*/
&[horizontally-distributed~="around"] {
justify-content: space-around;
}
&[horizontally-distributed~="between"] {
justify-content: space-between;
}
&[horizontally-distributed~="equal"] {
> * {
flex-grow: 1;
}
}
&[vertically-distributed~="around"] {
align-content: space-around;
}
&[vertically-distributed~="between"] {
align-content: space-between;
}
&[vertically-distributed~="equal"] {
align-items: stretch;
}
/*
SIZE
- Instead of col-xs-12 or whatever
- Specify size on the parent
*/
&[columns~="2"] > * {
flex-basis: (100% / 2);
}
&[columns~="3"] > * {
flex-basis: (100% / 3);
}
&[columns~="4"] > * {
flex-basis: (100% / 4);
}
&[columns~="5"] > * {
flex-basis: (100% / 5);
}
&[columns~="6"] > * {
flex-basis: (100% / 6);
}
&[columns~="7"] > * {
flex-basis: (100% / 7);
}
&[columns~="8"] > * {
flex-basis: (100% / 8);
}
&[columns~="9"] > * {
flex-basis: (100% / 9);
}
&[columns~="10"] > * {
flex-basis: (100% / 10);
}
&[columns~="11"] > * {
flex-basis: (100% / 11);
}
&[columns~="12"] > * {
flex-basis: (100% / 12);
}
}
// column specific
[grid~="columns"] {
&[vertically-distributed~="equal"] {
align-items: stretch;
> * {
height: auto;
}
}
}
// row specific
[grid~="rows"] {
flex-direction: column;
align-items: flex-start;
&[order~="reverse"] {
flex-direction: column-reverse;
}
&[horizontally-aligned~="center"] {
align-items: center;
}
&[horizontally-aligned~="right"] {
align-items: flex-end;
}
&[vertically-distributed~="around"] {
justify-content: space-around;
}
&[vertically-distributed~="between"] {
justify-content: space-between;
}
&[vertically-distributed~="equal"] {
> * {
width: initial;
}
}
}
[grid~="masonry"] {
flex-flow: column wrap;
height: 20rem;
}