[英]Can I hide html5 video tag on everything but desktops?
Is there a way to do that? 有没有办法做到这一点? I don't want the video showing up on tablets or phones. 我不希望视频出现在平板电脑或手机上。
Use CSS media queries like this: 使用CSS媒体查询,如下所示:
@media screen and (max-width: 680px)
{
.video { display : none; }
}
This will hide the class .video for all screens up to 680px wide 这将隐藏所有屏幕最大680px的class .video
Edit: You can of course also do this the other way around, and set .video
to display: none
by default, and then use min-width
inside a media query to actually show it from a certain width. 编辑:当然,您也可以采用其他方法,并将.video
设置为display: none
默认情况下display: none
,然后在媒体查询中使用min-width
实际从某个宽度显示它。
Yes, with media queries: 是的,使用媒体查询:
<div id="video">
//Video here
</div>
@media only screen and (max-width: 500px) {
#video {
visibility: hidden;
}
}
This will hide the div with the ID of "video" for screensizes smaller than 500px (or whatever pixel width you determine). 对于小于500像素(或您确定的任何像素宽度)的屏幕尺寸,这将隐藏ID为“视频”的div。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.