Resposive với video
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Responsive Videos</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="m-4">
<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 "Show Output") and resize the browser window to see how responsive videos work.
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
<h2 class="mt-4">Video with 21:9 aspect ratio</h2>
<div class="ratio ratio-21x9">
<iframe src="//www.youtube.com/embed/YE7VzlLtp-4" title="YouTube video" allowfullscreen></iframe>
</div>
<h2 class="mt-4">Video with 16:9 aspect ratio</h2>
<div class="ratio ratio-16x9">
<iframe src="//www.youtube.com/embed/YE7VzlLtp-4" title="YouTube video" allowfullscreen></iframe>
</div>
<h2 class="mt-4">Video with 4:3 aspect ratio</h2>
<div class="ratio ratio-4x3">
<iframe src="//www.youtube.com/embed/YE7VzlLtp-4" title="YouTube video" allowfullscreen></iframe>
</div>
<h2 class="mt-4">Video with 1:1 aspect ratio</h2>
<div class="ratio ratio-1x1">
<iframe src="//www.youtube.com/embed/YE7VzlLtp-4" title="YouTube video" allowfullscreen></iframe>
</div>
</div>
</body>
</html>
Thấy bài viết hữu ích?
Ủng hộ tác giả để có thêm nhiều bài viết chất lượng nhé!