【发布时间】:2018-07-19 09:25:17
【问题描述】:
我正在尝试创建一个响应式代码,以便从 iframe 和带有可点击链接的 HTML 5 视频中获得两全其美的效果。在我的设置中,我想编写一个内联 @media 查询,仅在大于 375 像素时播放 Iframe,如果小于 375 像素,则在同一 div 块中播放 HTML 视频item white
我不知道如何显示隐藏而不是显示<video>
我的老板确信这是他想要的方式:S
@media only screen and (min-width: 375px) {
div.video {
position: relative;
height: 0;
padding-bottom: 56.25%;
}
}
div.video>iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<div class="item white">
<div class="video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/TIB3q68ZHYw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
</div>
<div class="item white">
<a href="https://www.walmart.com">
<video width="100%" height="100%" loop autoplay muted preload="metadata"> .
<source src="https://player.vimeo.com/external/274117996.sd.mp4?
s=d8982e09554557a0a5db18f8c5d450252fbcddbc&profile_id=165"
type="video/mp4" />
Your browser does not support the video tag. I suggest you upgrade
your browser.
</video>
</a>
</div>
【问题讨论】:
标签: css html media-queries