Source

Embeds

Nggawe video responsif utawa slideshow embeds adhedhasar jembaré wong tuwa kanthi nggawe rasio intrinsik sing timbangan ing piranti apa wae.

Babagan

Aturan langsung ditrapake kanggo <iframe>, <embed>, <video>, lan <object>unsur; opsional nggunakake kelas turunan eksplisit .embed-responsive-itemyen sampeyan pengin cocog gaya kanggo atribut liyane.

Pro-Tip! Sampeyan ora perlu kanggo kalebu frameborder="0"ing <iframe>s minangka kita override sing kanggo sampeyan.

Tuladha

Bungkus sembarang embed kaya <iframe>ing unsur induk karo .embed-responsivelan rasio aspek. Iki .embed-responsive-itemora dibutuhake, nanging kita nyengkuyung.

<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
</div>

Rasio aspek

Rasio aspek bisa disesuaikan karo kelas modifier. Secara default, kelas rasio ing ngisor iki diwenehake:

<!-- 21:9 aspect ratio -->
<div class="embed-responsive embed-responsive-21by9">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

<!-- 1:1 aspect ratio -->
<div class="embed-responsive embed-responsive-1by1">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

Ing _variables.scss, sampeyan bisa ngganti rasio aspek sing pengin digunakake. Punika conto $embed-responsive-aspect-ratiosdhaptar:

$embed-responsive-aspect-ratios: (
  (21 9),
  (16 9),
  (3 4),
  (1 1)
) !default;