2017-04-11 73 views
0

我有一个YouTube视频在一个HTML部分是响应。 当我调整浏览器的大小时,youtube视频会溢出到第二部分。如何使背景图像与YouTube视频溢出

如何使第一部分的背景图像与YouTube视频一起扩展?

When browser is resized the youtube video is bigger than the background image 1. How to I resize background image 1 with the youtube video

我需要保持这种HTML部分中时,它在横向模式下的移动或者我需要的背景图像拉伸以适应它。

HTML

#work { 
 
    text-align: center; 
 
    background: #3B3B3B url('https://bingo.jpg') no-repeat center center; 
 
    background-size: cover; 
 
    color: #ffffff; 
 
    height: 100vh; 
 
    display: -webkit-flex; 
 
    display: -ms-flexbox; 
 
    display: flex; 
 
    -webkit-align-items: center; 
 
    -ms-flex-align: center; 
 
    align-items: center; 
 
    background-overflow: visible; 
 
} 
 

 
#work h3 { 
 
    margin-top: 0px; 
 
    font-size: 18px; 
 
}
<!-- work section --> 
 
<section id="work"> 
 

 
    <div class="container"> 
 
    <div class="row"> 
 
     <div class="col-md-12 col-sm-12"> 
 
     <!-- \t <div class="section-title"> --> 
 
     <h1> <strong>Sample of Our Work</strong> </h1> 
 
     <hr></hr> 
 
     <!-- \t </div> --> 
 
     </div> 
 

 
    </div> 
 
    <div class="row"> 
 
     <div class="col-md-12 "> 
 
     <div class="video-container"> 
 
      <div class="video-wrapper"> 
 
      <iframe src="https://www.youtube.com/embed/qDgWfVqG_3E" frameborder="0" allowfullscreen></iframe> 
 
      </div> 
 
     </div> 
 
     </div> 
 
    </div> 
 

 
    </div> 
 
</section>

+3

取代它把一些代码在你的问题你身边已经尝试了什么?创建一个小提琴或codepen使我们能够帮助你。谢谢。 –

+0

我认为你应该让你的视频响应,请优先考虑响应视频。 http://fitvidsjs.com/ – Rohan

+0

@Rohan它已经响应。 – femi

回答

0

不用担心所有。

我只是去掉了CSS与

#work { 
 
text-align: center; 
 
    background: #3B3B3B url('https:screaming buzzrd.jpg') no-repeat center center; 
 
    background-size: cover; 
 
    color: #ffffff; 
 
    height: 100vh; 
 

 

 
} 
 

 

 
.video-wrapper {position: relative; 
 
\t \t \t \t \t \t \t padding-bottom: 56.25%; /* 16:9 */ 
 
\t \t \t \t \t \t \t padding-top: 25px; 
 
\t \t \t \t \t \t \t margin: auto;} 
 
.video-wrapper iframe {position: absolute; 
 
\t \t \t \t \t \t \t  \t \t top: 20%; 
 
\t \t \t \t \t \t \t \t \t left: 25%; 
 
\t \t \t \t \t \t \t \t \t width: 100%; 
 
\t \t \t \t \t \t \t \t \t height: 100%; 
 
} 
 
.container {width: 100%; margin: auto; }