Last active
April 17, 2019 06:16
-
-
Save hefhuman/f4b0a80f01e3d6d11c9fda4cb291453e to your computer and use it in GitHub Desktop.
add image to relative parent with the size of your desire;position the image with relative with z-index of 0 and width:100%;heightauto; ;then your iframe with position absolute;with top:0;left:0;z-index:1;width:100%;height:100%;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--THE EFFECTIVE WAY IS ON THE BOTTOM--> | |
<div class="container"> | |
<figure><img src="<?php bloginfo('template_url'); ?>/images/mid_img1.jpg" alt="dummy youtube video with company logo"></figure> | |
<iframe src="https://player.vimeo.com/video/279335650" allowfullscreen></iframe> | |
</div> | |
<!--The height will depends on the image that why it will be responsive;--> | |
<style> | |
.middle_con1 .container iframe{width: 100%;height: 100%;top:0;left:0;position: absolute;z-index: 1;} | |
.middle_con1 .container figure{position: relative;z-index: 0;} | |
.middle_con1 .container{width:100%;height:auto;position: relative;} | |
</style> | |
<!--THE EFFECTIVE WAY IS ON THE BOTTOM--> | |
<!--EFFECTIVE METHOD UPDATED--> | |
<style> | |
padding-top: calc(233.9 / 333.9 * 100%); /*/put this on to parent div*/ | |
make the video absolute with width 100% and height 100%;top:0 left:0 | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment