Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit a510303

Browse files
committed
feat(scss): add modern css grid support to legacy column classnames for easier transition
1 parent e570eeb commit a510303

33 files changed

+862
-600
lines changed

examples/bootstrap/css-gridish/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ If you are new to CSS Grid, please try [learning the basics](https://www.google.
7373
| `.bootstrap-padding` | Add one unit of padding to element on all sides |
7474
| `.bootstrap-padding--[bottom, left, right, top]` | Add one unit of padding to element on one side |
7575
| `.bootstrap-padding--[horizontal, vertical]` | Add one unit of padding to element on two sides |
76+
| `.bootstrap-grid__col--sm--[1-12]` | Set the width out of 12 columns for an item in the grid starting at the sm breakpoint |
77+
| `.bootstrap-grid__col--[sm]--0` | Do not display item at a specific breakpoint, but display at the next breakpoint with columns specified |
78+
| `.bootstrap-grid__col--[sm]--0--only` | Do not display item only at specific breakpoint |
7679

7780
By default, the grid code uses fluid columns and fixed rows. You can switch both aspects with `.bootstrap-grid--fixed-columns` and `.bootstrap-grid--fluid-rows`.
7881

82+
If you follow the instructions above for custom breakpoints, all of these legacy classes will generate with a version for each custom breakpoint too. For example, adding the custom breakpoint of `whateversize` will create `.bootstrap-grid__col--whateversize--1`. Since that custom breakpoint is right after the previous breakpoint, it will have the same amount of columns and min-height.
83+
7984
### Legacy
8085

8186
The following classes are only necessary if supporting browsers that do not have [CSS Grid Layout support](https://developer.mozilla.org/en-US/docs/Web/CSS/grid#Browser_compatibility). The previous classes are also necessary for modern browsers.
@@ -84,17 +89,12 @@ Please remember that the classes below have no affect on browsers that have [CSS
8489

8590
| Class Name | Purpose |
8691
| ----------------------------------------- | ------------------------------------------------------------------------------------------ |
87-
| `.bootstrap-grid__col--sm--[1-12]` | Set the width out of 12 columns for an item in the grid starting at the sm breakpoint |
88-
| `.bootstrap-grid__col--[sm]--0` | Do not display item at a specific breakpoint, but display at the next breakpoint with columns specified |
89-
| `.bootstrap-grid__col--[sm]--0--only` | Do not display item only at specific breakpoint |
9092
| `.bootstrap-grid__height-fixed--[sm]--[1-30]` | Set the min-height based on an interval of 15px for an item starting at the breakpoint specified |
9193
| `.bootstrap-grid__height-fluid--sm--[1-12]` | Set the min-height on the width of 1-12 columns for an item starting at the sm breakpoint |
9294
| `.bootstrap-grid__height--[sm]--0` | Reset the min-height for an item starting at the specified breakpoint |
9395

9496
The legacy `.bootstrap-grid__height-fixed--[sm]--[1-30]` class follows the numbering system as described in our height variables](#Fixed Height).
9597

96-
If you follow the instructions above for custom breakpoints, all of these legacy classes will generate with a version for each custom breakpoint too. For example, adding the custom breakpoint of `35` will create `.bootstrap-grid__col--35--1` and `.bootstrap-grid__height-fixed--35--1`. Since that custom breakpoint is right after the previous breakpoint, it will have the same amount of columns and min-height.
97-
9898
## Variables
9999

100100
If your project is comfortable with the browser support for
Binary file not shown.

examples/bootstrap/css-gridish/css/bootstrap-grid-legacy.css

Lines changed: 116 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ body {
3030
flex-wrap: wrap;
3131
position: relative; }
3232
.bootstrap-grid > * {
33-
box-sizing: border-box; }
33+
box-sizing: border-box;
34+
grid-column: span 100; }
3435
.bootstrap-grid > * :last-child,
3536
.bootstrap-grid > * :last-child > :last-child,
3637
.bootstrap-grid > * :last-child > :last-child > :last-child {
@@ -52,6 +53,96 @@ body {
5253
.bootstrap-grid > * {
5354
height: 100%; } }
5455

56+
.bootstrap-grid__height--sm--0 {
57+
height: 0; }
58+
59+
.bootstrap-grid__height-fixed--sm--1 {
60+
height: 1rem; }
61+
62+
.bootstrap-grid__height-fixed--sm--2 {
63+
height: 2rem; }
64+
65+
.bootstrap-grid__height-fixed--sm--3 {
66+
height: 3rem; }
67+
68+
.bootstrap-grid__height-fixed--sm--4 {
69+
height: 4rem; }
70+
71+
.bootstrap-grid__height-fixed--sm--5 {
72+
height: 5rem; }
73+
74+
.bootstrap-grid__height-fixed--sm--6 {
75+
height: 6rem; }
76+
77+
.bootstrap-grid__height-fixed--sm--7 {
78+
height: 7rem; }
79+
80+
.bootstrap-grid__height-fixed--sm--8 {
81+
height: 8rem; }
82+
83+
.bootstrap-grid__height-fixed--sm--9 {
84+
height: 9rem; }
85+
86+
.bootstrap-grid__height-fixed--sm--10 {
87+
height: 10rem; }
88+
89+
.bootstrap-grid__height-fixed--sm--11 {
90+
height: 11rem; }
91+
92+
.bootstrap-grid__height-fixed--sm--12 {
93+
height: 12rem; }
94+
95+
.bootstrap-grid__height-fixed--sm--13 {
96+
height: 13rem; }
97+
98+
.bootstrap-grid__height-fixed--sm--14 {
99+
height: 14rem; }
100+
101+
.bootstrap-grid__height-fixed--sm--15 {
102+
height: 15rem; }
103+
104+
.bootstrap-grid__height-fixed--sm--16 {
105+
height: 16rem; }
106+
107+
.bootstrap-grid__height-fixed--sm--17 {
108+
height: 17rem; }
109+
110+
.bootstrap-grid__height-fixed--sm--18 {
111+
height: 18rem; }
112+
113+
.bootstrap-grid__height-fixed--sm--19 {
114+
height: 19rem; }
115+
116+
.bootstrap-grid__height-fixed--sm--20 {
117+
height: 20rem; }
118+
119+
.bootstrap-grid__height-fixed--sm--21 {
120+
height: 21rem; }
121+
122+
.bootstrap-grid__height-fixed--sm--22 {
123+
height: 22rem; }
124+
125+
.bootstrap-grid__height-fixed--sm--23 {
126+
height: 23rem; }
127+
128+
.bootstrap-grid__height-fixed--sm--24 {
129+
height: 24rem; }
130+
131+
.bootstrap-grid__height-fixed--sm--25 {
132+
height: 25rem; }
133+
134+
.bootstrap-grid__height-fixed--sm--26 {
135+
height: 26rem; }
136+
137+
.bootstrap-grid__height-fixed--sm--27 {
138+
height: 27rem; }
139+
140+
.bootstrap-grid__height-fixed--sm--28 {
141+
height: 28rem; }
142+
143+
.bootstrap-grid__height-fixed--sm--29 {
144+
height: 29rem; }
145+
55146
[class*="bootstrap-grid__col--sm--"] {
56147
display: block; }
57148

@@ -62,7 +153,8 @@ body {
62153
.bootstrap-grid__col--sm--1 {
63154
max-width: calc( 100rem / 12 * 1);
64155
min-width: 8.33333vw;
65-
width: 8.33333vw; }
156+
width: 8.33333vw;
157+
grid-column: span 1; }
66158

67159
.bootstrap-grid__height-fluid--sm--1 {
68160
height: 8.33333vw;
@@ -71,7 +163,8 @@ body {
71163
.bootstrap-grid__col--sm--2 {
72164
max-width: calc( 100rem / 12 * 2);
73165
min-width: 16.66667vw;
74-
width: 16.66667vw; }
166+
width: 16.66667vw;
167+
grid-column: span 2; }
75168

76169
.bootstrap-grid__height-fluid--sm--2 {
77170
height: 16.66667vw;
@@ -80,7 +173,8 @@ body {
80173
.bootstrap-grid__col--sm--3 {
81174
max-width: calc( 100rem / 12 * 3);
82175
min-width: 25vw;
83-
width: 25vw; }
176+
width: 25vw;
177+
grid-column: span 3; }
84178

85179
.bootstrap-grid__height-fluid--sm--3 {
86180
height: 25vw;
@@ -89,7 +183,8 @@ body {
89183
.bootstrap-grid__col--sm--4 {
90184
max-width: calc( 100rem / 12 * 4);
91185
min-width: 33.33333vw;
92-
width: 33.33333vw; }
186+
width: 33.33333vw;
187+
grid-column: span 4; }
93188

94189
.bootstrap-grid__height-fluid--sm--4 {
95190
height: 33.33333vw;
@@ -98,7 +193,8 @@ body {
98193
.bootstrap-grid__col--sm--5 {
99194
max-width: calc( 100rem / 12 * 5);
100195
min-width: 41.66667vw;
101-
width: 41.66667vw; }
196+
width: 41.66667vw;
197+
grid-column: span 5; }
102198

103199
.bootstrap-grid__height-fluid--sm--5 {
104200
height: 41.66667vw;
@@ -107,7 +203,8 @@ body {
107203
.bootstrap-grid__col--sm--6 {
108204
max-width: calc( 100rem / 12 * 6);
109205
min-width: 50vw;
110-
width: 50vw; }
206+
width: 50vw;
207+
grid-column: span 6; }
111208

112209
.bootstrap-grid__height-fluid--sm--6 {
113210
height: 50vw;
@@ -116,7 +213,8 @@ body {
116213
.bootstrap-grid__col--sm--7 {
117214
max-width: calc( 100rem / 12 * 7);
118215
min-width: 58.33333vw;
119-
width: 58.33333vw; }
216+
width: 58.33333vw;
217+
grid-column: span 7; }
120218

121219
.bootstrap-grid__height-fluid--sm--7 {
122220
height: 58.33333vw;
@@ -125,7 +223,8 @@ body {
125223
.bootstrap-grid__col--sm--8 {
126224
max-width: calc( 100rem / 12 * 8);
127225
min-width: 66.66667vw;
128-
width: 66.66667vw; }
226+
width: 66.66667vw;
227+
grid-column: span 8; }
129228

130229
.bootstrap-grid__height-fluid--sm--8 {
131230
height: 66.66667vw;
@@ -134,7 +233,8 @@ body {
134233
.bootstrap-grid__col--sm--9 {
135234
max-width: calc( 100rem / 12 * 9);
136235
min-width: 75vw;
137-
width: 75vw; }
236+
width: 75vw;
237+
grid-column: span 9; }
138238

139239
.bootstrap-grid__height-fluid--sm--9 {
140240
height: 75vw;
@@ -143,7 +243,8 @@ body {
143243
.bootstrap-grid__col--sm--10 {
144244
max-width: calc( 100rem / 12 * 10);
145245
min-width: 83.33333vw;
146-
width: 83.33333vw; }
246+
width: 83.33333vw;
247+
grid-column: span 10; }
147248

148249
.bootstrap-grid__height-fluid--sm--10 {
149250
height: 83.33333vw;
@@ -152,7 +253,8 @@ body {
152253
.bootstrap-grid__col--sm--11 {
153254
max-width: calc( 100rem / 12 * 11);
154255
min-width: 91.66667vw;
155-
width: 91.66667vw; }
256+
width: 91.66667vw;
257+
grid-column: span 11; }
156258

157259
.bootstrap-grid__height-fluid--sm--11 {
158260
height: 91.66667vw;
@@ -161,102 +263,13 @@ body {
161263
.bootstrap-grid__col--sm--12 {
162264
max-width: calc( 100rem / 12 * 12);
163265
min-width: 100vw;
164-
width: 100vw; }
266+
width: 100vw;
267+
grid-column: span 12; }
165268

166269
.bootstrap-grid__height-fluid--sm--12 {
167270
height: 100vw;
168271
max-height: calc( 100rem / 12 * 12); }
169272

170-
.bootstrap-grid__height--sm--0 {
171-
height: 0; }
172-
173-
.bootstrap-grid__height-fixed--sm--1 {
174-
height: 1rem; }
175-
176-
.bootstrap-grid__height-fixed--sm--2 {
177-
height: 2rem; }
178-
179-
.bootstrap-grid__height-fixed--sm--3 {
180-
height: 3rem; }
181-
182-
.bootstrap-grid__height-fixed--sm--4 {
183-
height: 4rem; }
184-
185-
.bootstrap-grid__height-fixed--sm--5 {
186-
height: 5rem; }
187-
188-
.bootstrap-grid__height-fixed--sm--6 {
189-
height: 6rem; }
190-
191-
.bootstrap-grid__height-fixed--sm--7 {
192-
height: 7rem; }
193-
194-
.bootstrap-grid__height-fixed--sm--8 {
195-
height: 8rem; }
196-
197-
.bootstrap-grid__height-fixed--sm--9 {
198-
height: 9rem; }
199-
200-
.bootstrap-grid__height-fixed--sm--10 {
201-
height: 10rem; }
202-
203-
.bootstrap-grid__height-fixed--sm--11 {
204-
height: 11rem; }
205-
206-
.bootstrap-grid__height-fixed--sm--12 {
207-
height: 12rem; }
208-
209-
.bootstrap-grid__height-fixed--sm--13 {
210-
height: 13rem; }
211-
212-
.bootstrap-grid__height-fixed--sm--14 {
213-
height: 14rem; }
214-
215-
.bootstrap-grid__height-fixed--sm--15 {
216-
height: 15rem; }
217-
218-
.bootstrap-grid__height-fixed--sm--16 {
219-
height: 16rem; }
220-
221-
.bootstrap-grid__height-fixed--sm--17 {
222-
height: 17rem; }
223-
224-
.bootstrap-grid__height-fixed--sm--18 {
225-
height: 18rem; }
226-
227-
.bootstrap-grid__height-fixed--sm--19 {
228-
height: 19rem; }
229-
230-
.bootstrap-grid__height-fixed--sm--20 {
231-
height: 20rem; }
232-
233-
.bootstrap-grid__height-fixed--sm--21 {
234-
height: 21rem; }
235-
236-
.bootstrap-grid__height-fixed--sm--22 {
237-
height: 22rem; }
238-
239-
.bootstrap-grid__height-fixed--sm--23 {
240-
height: 23rem; }
241-
242-
.bootstrap-grid__height-fixed--sm--24 {
243-
height: 24rem; }
244-
245-
.bootstrap-grid__height-fixed--sm--25 {
246-
height: 25rem; }
247-
248-
.bootstrap-grid__height-fixed--sm--26 {
249-
height: 26rem; }
250-
251-
.bootstrap-grid__height-fixed--sm--27 {
252-
height: 27rem; }
253-
254-
.bootstrap-grid__height-fixed--sm--28 {
255-
height: 28rem; }
256-
257-
.bootstrap-grid__height-fixed--sm--29 {
258-
height: 29rem; }
259-
260273
.bootstrap-padding {
261274
padding: calc(30px / 2); }
262275

@@ -356,7 +369,6 @@ body {
356369

357370
@supports (display: grid) {
358371
.bootstrap-grid > * {
359-
display: initial;
360372
min-width: initial;
361373
max-width: initial;
362374
width: initial; }

0 commit comments

Comments
 (0)