Bootstrap 4 – Responsive Embed

Bootstrap 4 giúp Responsive videos và media khác khi được nhúng vào.

Element nhúng vào được Responsive như <iframe>, <video>, <object>, và <embed>.

Để respinsive chúng, bạn cần dùng class .embed-responsive và cùng tỷ lệ ví dụ (.responsive-embed-16by9, .responsive-embed-4by3).

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>

<body>

  <div class="container">
    <div class="embed-responsive embed-responsive-16by9">
      <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/wMuNjnNyaiA" allowfullscreen></iframe>
      </div>
  </div>

</body>

</html>