Stripped personal data from development repository
Samo Penic
2019-02-20 83c3f647c35477564b77cbc5b36d37d793d5442a
commit | author | age
83c3f6 1 ---
SP 2 layout: docs
3 title: Embeds
4 description: Create responsive video or slideshow embeds based on the width of the parent by creating an intrinsic ratio that scales on any device.
5 group: utilities
6 toc: true
7 ---
8
9 ## About
10
11 Rules are directly applied to `<iframe>`, `<embed>`, `<video>`, and `<object>` elements; optionally use an explicit descendant class `.embed-responsive-item` when you want to match the styling for other attributes.
12
13 **Pro-Tip!** You don't need to include `frameborder="0"` in your `<iframe>`s as we override that for you.
14
15 ## Example
16
17 Wrap any embed like an `<iframe>` in a parent element with `.embed-responsive` and an aspect ratio. The `.embed-responsive-item` isn't strictly required, but we encourage it.
18
19 {% capture example %}
20 <div class="embed-responsive embed-responsive-16by9">
21   <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
22 </div>
23 {% endcapture %}
24 {% include example.html content=example %}
25
26 ## Aspect ratios
27
28 Aspect ratios can be customized with modifier classes. By default the following ratio classes are provided:
29
30 {% highlight html %}
31 <!-- 21:9 aspect ratio -->
32 <div class="embed-responsive embed-responsive-21by9">
33   <iframe class="embed-responsive-item" src="..."></iframe>
34 </div>
35
36 <!-- 16:9 aspect ratio -->
37 <div class="embed-responsive embed-responsive-16by9">
38   <iframe class="embed-responsive-item" src="..."></iframe>
39 </div>
40
41 <!-- 4:3 aspect ratio -->
42 <div class="embed-responsive embed-responsive-4by3">
43   <iframe class="embed-responsive-item" src="..."></iframe>
44 </div>
45
46 <!-- 1:1 aspect ratio -->
47 <div class="embed-responsive embed-responsive-1by1">
48   <iframe class="embed-responsive-item" src="..."></iframe>
49 </div>
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 %}