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; }
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
Post a Comment