CSS Fluid Width Video | Drupal 8

CSS Fluid Width Video

Submitted by nuwantha on Mon, 07/24/2017 - 23:43
Question

How to set width of a youtube video automaticly ?

Example :

<div class="video-content">
    <!-- YouTube video code-->
    <iframe width="560" height="349" src="http://www.youtube.com/embed/THEVIDEOID" frameborder="0" allowfullscreen></iframe>
</div>

.video-content {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  padding-top: 25px;
  height: 0;
  iframe {
    position: absolute;
    height: 100%;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
  }
}

Tags

Comments

Add new comment