根据实际图像属性,图像的宽度为400x400。 现在我有兄弟视频,它应该具有相同的图像宽度和高度。 如何将图像宽度和高度属性继承到视频标记
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;
}
答案 0 :(得分:2)
把东西变成一个类,然后把div class =&#34; stuff&#34;围绕视频
#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;}