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