in English

ฝัง

สร้างวิดีโอที่ตอบสนองหรือฝังสไลด์โชว์ตามความกว้างของพาเรนต์โดยสร้างอัตราส่วนที่แท้จริงที่ปรับขนาดบนอุปกรณ์ใดก็ได้

เกี่ยวกับ

กฎมีผลโดยตรงกับ<iframe>, <embed>, <video>, และ<object>องค์ประกอบ เลือกใช้คลาสลูกหลานที่ชัดเจน.embed-responsive-itemเมื่อคุณต้องการจับคู่สไตล์สำหรับแอตทริบิวต์อื่นๆ

โปร-ทิป! คุณไม่จำเป็นต้องรวมframeborder="0"ใน<iframe>s ของคุณในขณะที่เราแทนที่สิ่งนั้นเพื่อคุณ

ตัวอย่าง

ล้อมการฝังใดๆ เช่น<iframe>ในองค์ประกอบหลักด้วย.embed-responsiveและ อัตราส่วนกว้างยาว ไม่.embed-responsive-itemจำเป็นอย่างเคร่งครัด แต่เราสนับสนุนให้

<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>

อัตราส่วนภาพ

อัตราส่วนภาพสามารถปรับแต่งได้ด้วยคลาสตัวปรับแต่ง โดยค่าเริ่มต้น คลาสอัตราส่วนต่อไปนี้จะถูกจัดเตรียม:

<!-- 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>

ภายใน_variables.scssคุณสามารถเปลี่ยนอัตราส่วนกว้างยาวที่คุณต้องการใช้ นี่คือตัวอย่างของ$embed-responsive-aspect-ratiosรายการ:

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