代码之家  ›  专栏  ›  技术社区  ›  Dismantle

视频高度100vh忽略隐藏的溢出。

  •  0
  • Dismantle  · 技术社区  · 7 年前

    我在胡闹,用100vh让jumbotron和它的背景填充用户的屏幕。我在使用照片时没有这个问题,但我的客户想要一个视频背景。

    我已将溢出设置为隐藏,但该网站正在显示带有水平滚动条的溢出。我不明白为什么它不能切断它。

    Website Here

        #video-background { 
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        overflow: hidden;
        z-index: -1000;
        height: 100vh;
        }
    
       .jumbotron{
        font-family: 'Raleway', Helvetica, Arial;
        background: rgba(0,0,0,0.6);
        background-size: cover;
        background-position: center;
        height: 100vh;
        padding: 60px 0;
        margin: 0;
        position: relative;
        overflow: hidden;
        }
    

    HTML

        <div class="jumbotron">
           <video id="video-background" preload muted autoplay loop>
              <source src="vid/lowres.mp4" type="video/mp4">
           </video>
        </div>
    

    很明显,jumbotron里面还有更多,但我认为这与此无关。

    2 回复  |  直到 7 年前
        1
  •  0
  •   Sameer    7 年前

    Overfow-x:隐藏;在chrome中对我来说很好。我没有看到任何水平滚动条。试试看

    .jumbotron{
        font-family: 'Raleway', Helvetica, Arial;
        background: rgba(0,0,0,0.6);
        background-size: cover;
        background-position: center;
        height: 100vh;
        padding: 60px 0;
        margin: 0;
        position: relative;
        overflow-x: hidden;
        }
    
        2
  •  0
  •   stevenlacerda    7 年前

    如果将其设置得太低,请尝试在其上方的DOM节点上设置。jumbotron为我开发了chrome。