2015-04-06 265 views
-1

我需要设置100%宽度视频和500px高度。有没有这个机会?我检查了这个网站上的帖子,发现只有100%背景的代码:100%宽度视频和500px高度

#video_background { 
       position: fixed; 
       top: 0px; 
       left: 0px; 
       min-width: 100%; 
       min-height: 100%; 
       width: auto; 
       height: auto; 
       z-index: -1000; 
       background: url(assets/picture.jpg) no-repeat; 
       background-size: cover; 
       overflow: hidden; 
       } 
+0

不设置'宽度:100%;'和'高度:500像素;'作品? – 2015-04-06 02:01:39

+0

我们可以看到您的HTML代码吗? – 2015-04-06 02:17:55

回答

0

这是一篇很好的解释文章。

https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php

您可以设置<video width="100%" ...或CSS设置

#video_background{ 
    width: 100% !important; 
    height: auto !important; 
} 
+0

它不起作用。看看我的网站。 http://bielskiepu.tk/stay/ – 2015-04-06 15:07:30

+0

你通过什么方式“不起作用”。你想切出500px以下的部分?那么为什么不把它包装在一个div中,并使溢出隐藏? – 2015-04-06 16:59:56