【发布时间】:2022-01-21 22:47:20
【问题描述】:
抱歉英语不好。有什么想法可以在不使用边距等的情况下将其移动到中心?也许还有其他方法。
图像和视频是否可以在任何移动屏幕上自动调整?在我使用的代码下方:
HTML
<div id="tv_container">
<iframe width="720" height="480" src="https://www.youtube.com/embed/vToBbWibGw8?controls=0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
CSS
#tv_container {
width: 720px;
height: 480px;
position: relative;
}
#tv_container:after { //frame
content: '';
display: block;
background: url('../home-img/framevid(4).png') no-repeat top left transparent;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
position: absolute;
z-index: 10;
}
#tv_container iframe { //video
position: absolute;
top: 30px;
left: 40px;
z-index: 5;
}
【问题讨论】:
-
你看过 flex 吗?
-
我没有尝试过灵活的盒子,会尝试这样做。我认为这可能会有所帮助。
标签: javascript html css vue.js