根据实际的图片属性,图片的宽度为400x400。现在,我有同级视频,该视频应具有与图像相同的宽度和高度。我如何继承Image width和height属性到视频标签
HTML:
<div id="holder">
<img src="http://placehold.it/400x400" >
<video controls="">
<source src="mov_bbb.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</div>
CSS:
#holder {
position: relative;
}
#stuff {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
将内容归类,然后将div class =“ stuff”放到视频周围
#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;}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句