UNPKG

1.86 kBSCSSView Raw
1// Foundation for Sites by ZURB
2// foundation.zurb.com
3// Licensed under MIT Open Source
4
5////
6/// @group responsive-embed
7////
8
9/// Margin below a responsive embed container.
10/// @type Number
11$responsive-embed-margin-bottom: rem-calc(16) !default;
12
13/// Aspect ratios used to determine padding-bottom of responsive embed containers.
14/// @type Map
15$responsive-embed-ratios: (
16 default: 4 by 3,
17 widescreen: 16 by 9,
18) !default;
19
20// WARNING: Will be removed in version 6.4
21$responsive-embed-ratio: default;
22
23/// Creates a responsive embed container.
24/// @param {String|List} $ratio [default] - Ratio of the container. Can be a key from the `$responsive-embed-ratios` map or a list formatted as `x by y`.
25@mixin responsive-embed($ratio: default) {
26 @if type-of($ratio) == 'string' {
27 $ratio: map-get($responsive-embed-ratios, $ratio);
28 }
29 position: relative;
30 height: 0;
31 margin-bottom: $responsive-embed-margin-bottom;
32 padding-bottom: ratio-to-percentage($ratio);
33 overflow: hidden;
34
35 iframe,
36 object,
37 embed,
38 video {
39 position: absolute;
40 top: 0;
41 #{$global-left}: 0;
42 width: 100%;
43 height: 100%;
44 }
45}
46
47@mixin foundation-responsive-embed {
48 .responsive-embed,
49 .flex-video {
50 @include responsive-embed($ratio: default);
51
52 $ratios: map-remove($responsive-embed-ratios,default);
53
54 @each $name, $ratio in $ratios {
55 &.#{$name} {
56 padding-bottom: ratio-to-percentage($ratio);
57 }
58 }
59 }
60}
61
62@mixin foundation-flex-video {
63 @warn 'This mixin is being replaced by foundation-responsive-embed(). foundation-flex-video() will be removed in Foundation 6.4.';
64 @include foundation-responsive-embed;
65}
66
67@mixin flex-video($ratio: $responsive-embed-ratio) {
68 @warn 'This mixin is being replaced by responsive-embed(). flex-video() will be removed in Foundation 6.4.';
69 @include responsive-embed($ratio);
70}