File tree 3 files changed +30
-21
lines changed
3 files changed +30
-21
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,17 @@ $transition-base: all .2s ease-in-out !default;
259
259
$transition-fade : opacity .15s linear !default ;
260
260
$transition-collapse : height .35s ease !default ;
261
261
262
+ $embed-responsive-aspect-ratios : () !default ;
263
+ // stylelint-disable-next-line scss/dollar-variable-default
264
+ $embed-responsive-aspect-ratios : join (
265
+ (
266
+ (21 9 ),
267
+ (16 9 ),
268
+ (3 4 ),
269
+ (1 1 ),
270
+ ),
271
+ $embed-responsive-aspect-ratios
272
+ );
262
273
263
274
// Fonts
264
275
//
Original file line number Diff line number Diff line change 27
27
}
28
28
}
29
29
30
- .embed-responsive-21by9 {
31
- & ::before {
32
- padding-top : percentage (9 / 21 );
33
- }
34
- }
35
-
36
- .embed-responsive-16by9 {
37
- & ::before {
38
- padding-top : percentage (9 / 16 );
39
- }
40
- }
41
-
42
- .embed-responsive-4by3 {
43
- & ::before {
44
- padding-top : percentage (3 / 4 );
45
- }
46
- }
30
+ @each $embed-responsive-aspect-ratio in $embed-responsive-aspect-ratios {
31
+ $embed-responsive-aspect-ratio-x : nth ($embed-responsive-aspect-ratio , 1 );
32
+ $embed-responsive-aspect-ratio-y : nth ($embed-responsive-aspect-ratio , 2 );
47
33
48
- .embed-responsive-1by1 {
49
- & ::before {
50
- padding-top : percentage (1 / 1 );
34
+ .embed-responsive-#{$embed-responsive-aspect-ratio-x } by#{$embed-responsive-aspect-ratio-y } {
35
+ & ::before {
36
+ padding-top : percentage ($embed-responsive-aspect-ratio-y / $embed-responsive-aspect-ratio-x );
37
+ }
51
38
}
52
39
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ Wrap any embed like an `<iframe>` in a parent element with `.embed-responsive` a
25
25
26
26
## Aspect ratios
27
27
28
- Aspect ratios can be customized with modifier classes.
28
+ Aspect ratios can be customized with modifier classes. By default the following ratio classes are provided:
29
29
30
30
{% highlight html %}
31
31
<!-- 21:9 aspect ratio -->
@@ -48,3 +48,14 @@ Aspect ratios can be customized with modifier classes.
48
48
<iframe class =" embed-responsive-item " src =" ... " ></iframe >
49
49
</div >
50
50
{% endhighlight %}
51
+
52
+ Within ` _variables.scss ` , you can change the aspect ratios you want to use. Here's an example of the ` $embed-responsive-aspect-ratios ` list:
53
+
54
+ {% highlight scss %}
55
+ $embed-responsive-aspect-ratios: (
56
+ (21 9),
57
+ (16 9),
58
+ (3 4),
59
+ (1 1)
60
+ ) !default;
61
+ {% endhighlight %}
You can’t perform that action at this time.
0 commit comments