Skip to content

What's the right way to embed videos in Bootstrap 5.3? #40586

Answered by julien-deramond
dafaher asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @dafaher
Indeed, you had .embed-responsive in Bootstrap v4:

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

We’ve dropped the .embed-responsive-item and element group selector in favor of a simpler .ratio > * selector. No more class is needed, and the ratio helper now works with any HTML element:

<div class="ratio ratio-16x9">
  <iframe src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
</div>

See Bootstrap v5 > Ratios documentation.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dafaher
Comment options

Answer selected by dafaher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants