making an iframe responsive code example

Example: iframe responsive

<div class="row">	
  <div class="col-md-12 d-flex justify-content-center"> 
    <div class="video-iframe">
      <iframe class="video-responsive-iframe" src="<?= $blog_item['Blog']['video_url'] ?>" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    </div>
  </div>
</div>

<style>
  
  .video-iframe {
	position: relative;
	width: 100%;
	overflow: hidden;
	padding-top: 56.25%; /* 16:9 Aspect Ratio */
  }

  .video-responsive-iframe {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      width: 100%;
      height: 100%;
      border: none;
  }

  .d-flex {
  	display: flex;
  }
  
  .justify-content-center {
    justify-content: center;
  }
</style>

Tags:

Misc Example