2015-04-06 194 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