This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
forked from supple-kit/supple-css
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_flexembed.scss
80 lines (66 loc) · 1.76 KB
/
_flexembed.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
/* =========================================================================
objects.flexembed
For use with multi-media embeds, such as videos or slideshows, that need to
retain a specific aspect ratio but adapt to elements of variable widths.
========================================================================= */
/* Variables
========================================================================= */
/**
* Spacing
*/
$supple-flexembed-space: $supple-space !default;
/**
* Ratio's
* Define ’em like this:
* $supple-flexembed-ratios: (
* (2:1),
* (4:3),
* (16:9),
* );
*/
$supple-flexembed-ratios: (
(2:1),
(4:3),
(16:9)
) !default;
/* Module
========================================================================= */
/**
* 1. Default cropping is a perfect square, in you own modules you can override
* the ratio like this: (16/9)
*/
.o-flexembed {
--o-flexembed-ratio: (1/1); /* [1] */
position: relative;
display: block;
height: 0;
padding: 0 0 calc(100% / var(--o-flexembed-ratio));
overflow: hidden;
@include supple-rem(margin-bottom, $supple-flexembed-space);
}
/**
* The actual embed/item
*/
.o-flexembed__item,
.o-flexembed > iframe,
.o-flexembed > embed,
.o-flexembed > object {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
/* Common ratio modifiers, for use in browsers without
custom-property support
========================================================================= */
@each $ratio in $supple-flexembed-ratios {
@each $a, $b in $ratio {
@if (type-of($a) != number or type-of($b) != number) {
@error '`#{$a}` and `#{$b}` need to be numbers.';
}
.o-flexembed--#{$a}by#{$b} {
padding-bottom: 100% / ($a/$b);
}
}
}