我正面臨有關視頻寬度和高度的問題。現在,它佔據了全屏幕,但我希望它的寬度和高度都是我想要的全尺寸。例如,請參閱http://airbnb.com。如果有人能幫助我。謝謝設置視頻的寬度和高度
<div align="center">
<video autoplay loop id="video" class="con">
<source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
</video>
<div class="overlay">
<form>
<label for="input">Form Input Label</label>
<input id="input" name="input" value="" />
<button type="submit">Submit</button>
</form>
</div>
</div>
這是我使用的CSS。
.con {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
transform: translateX(-50%) translateY(-50%);
transition: 1s opacity;
}
.overlay {
position:absolute;
top:0;
left:0;
z-index:1;
}
本視頻中存在高度和寬度比率問題。如果我把它的高度降低到70%,它的寬度也會減小。 –