2014-03-07 02:18:13 -05:00
|
|
|
// Credit: Nicolas Gallagher and SUIT CSS.
|
|
|
|
|
2020-09-22 19:30:00 -04:00
|
|
|
.ratio {
|
2014-03-07 02:18:13 -05:00
|
|
|
position: relative;
|
2016-04-15 04:40:51 -04:00
|
|
|
width: 100%;
|
2014-03-07 02:18:13 -05:00
|
|
|
|
2016-04-15 04:40:51 -04:00
|
|
|
&::before {
|
|
|
|
display: block;
|
2020-09-21 17:15:15 -04:00
|
|
|
padding-top: var(--aspect-ratio);
|
2016-04-15 04:40:51 -04:00
|
|
|
content: "";
|
|
|
|
}
|
|
|
|
|
2020-09-23 14:06:21 -04:00
|
|
|
> * {
|
2014-03-07 02:18:13 -05:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
2014-12-11 15:05:29 -05:00
|
|
|
left: 0;
|
2014-03-07 02:18:13 -05:00
|
|
|
width: 100%;
|
2014-12-11 15:05:29 -05:00
|
|
|
height: 100%;
|
2014-03-07 02:18:13 -05:00
|
|
|
}
|
2015-02-02 12:26:30 -05:00
|
|
|
}
|
2014-03-07 02:18:13 -05:00
|
|
|
|
2020-09-22 19:30:00 -04:00
|
|
|
@each $key, $ratio in $aspect-ratios {
|
|
|
|
.ratio-#{$key} {
|
2020-09-21 17:15:15 -04:00
|
|
|
--aspect-ratio: #{$ratio};
|
2016-04-15 04:40:51 -04:00
|
|
|
}
|
2015-11-23 22:50:38 -05:00
|
|
|
}
|