embed-responsive-item
bootstrap5.css
bootstrap5.css
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
html bootstrap5 Sample
Embed埋め込み/アスペクト比16:9:embed-responsive
<!-- 大きさが自動調整される -->
<!-- アスペクト比を持つ親要素に iframe のような埋め込みをラップします -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/SGqg_ZzThDU?rel=0"
allowfullscreen></iframe>
</div>