html - How to inherit Image width and height to video tag -


image has width 400x400 per real image property. have sibling video should have same width , height of image. how can inherit image width , height property video tag

html:

<div id="holder"> <img src="http://placehold.it/400x400" > <video controls="">   <source src="mov_bbb.mp4" type="video/mp4">   browser not support html5 video. </video> </div> 

css:

#holder {   position: relative; }  #stuff {   position: absolute;   top: 0;   right: 0;   bottom: 0;   left: 0; } 

http://codepen.io/snehav27/pen/mjoypo

turn stuff class , put div class="stuff" around video

#holder {   position: absolute;  height:400px;  width:auto; }  .stuff {   position: absolute;   height:inherit;   width:inherit;   top: 0;   right: 0;   bottom: 0;   left: 0; }  .stuff video{position:absolute;             height:inherit;             width:inherit;             vertical-align:top;} 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -