嗨,我有一個背景YouTube視頻。我需要它做出反應。當我減小屏幕寬度時,它會變得更薄,所以這很好,但高度並沒有改變 - 它看起來有點像縮小得太快了....你可以在這裏看到它http://www.onscreencounselling.com/youtube video not resizing properly
請問有什麼不對
<?php if(is_page('homepage')){ ?>
<div id="video_background_video_0" style="z-index: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: hidden;">
<iframe id="video_background_video_0_yt" style="position: absolute; top: -179px; left: 0px;" frameborder="0" allowfullscreen="1" title="YouTube video player" width="1349" height="759" src="https://www.youtube.com/embed/1CXFhQ33_xs?loop=0&start=0&autoplay=1&controls=1&showinfo=0&wmode=transparent&iv_load_policy=3&modestbranding=1&rel=0&enablejsapi=1&origin=http%3A%2F%2Fwww.onscreencounselling.com"></iframe></div>
<?php } ?>
而這個CSS
#video_background_video_0 {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
嘿@maxelcat試試只是做高度:100%而不是身高:0;在#video_background_video_0中。它會解決你的問題。 – divy3993