"Responsive Videos"
Bootstrap 4.1.1 Snippet by divyalahad

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<body>
<div class="bs-example">
<div class="alert alert-info alert-dismissible fade show">
<strong>Note!</strong> Open the output in a new blank tab (click the arrow button next to "View fullscreen") and resize the browser window to see how responsive videos work.
<button type="button" class="close" data-dismiss="alert">×</button>
</div>
<h2 class="mt-4">Video with 21:9 aspect ratio</h2>
<div class="embed-responsive embed-responsive-21by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/sKJxH3_Z5bg"></iframe>
</div>
<h2 class="mt-4">Video with 16:9 aspect ratio</h2>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/sKJxH3_Z5bg"></iframe>
</div>
<h2 class="mt-4">Video with 4:3 aspect ratio</h2>
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/sKJxH3_Z5bg"></iframe>
</div>
<h2 class="mt-4">Video with 1:1 aspect ratio</h2>
<div class="embed-responsive embed-responsive-1by1">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/sKJxH3_Z5bg"></iframe>
</div>
</div>
</body>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
<style>
.bs-example{
margin: 20px;
}
</style>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: