Bootstrap 4全宽旋转木马

时间:2017-06-04 13:40:32

标签: html css twitter-bootstrap bootstrap-4

我的bs 4旋转木马有问题。我有视频,我希望它是全宽和高度,就像在这个链接https://www.jeunesseglobal.com/中一样。问题是我的视频位于中心,看起来像example

这是我的HTML

<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner" role="listbox">
      <div class="carousel-item active">
        <video autoplay="true" loop muted class="d-block img-fluid" src="img/video.mp4" type="video/mp4">
      </div>
    </div>
  </div>

我的CSS

video {
  width: 100vw;
  left: 0;
  right: 0;
}

无论我做什么,我都有点迷失视频仍处于中心位置并且不会传播

1 个答案:

答案 0 :(得分:0)

变化:

  1. 尝试CSS reset
  2. 将一些额外的CSS添加到hide the scrollbars but still be able to scroll
  3. 添加结束</video>代码
  4. video {
      width: 100vw;
      left: 0;
      right: 0;
    }
    
    #parent {
     overflow: hidden;
    }
    
    #carouselExampleSlidesOnly {
    overflow-y: scroll;
    }
    
    ::-webkit-scrollbar { 
        display: none; 
    }
    
    
    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed, 
    figure, figcaption, footer, header, hgroup, 
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	font-size: 100%;
    	font: inherit;
    	vertical-align: baseline;
    }
    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure, 
    footer, header, hgroup, menu, nav, section {
    	display: block;
    }
    body {
    	line-height: 1;
    }
    ol, ul {
    	list-style: none;
    }
    blockquote, q {
    	quotes: none;
    }
    blockquote:before, blockquote:after,
    q:before, q:after {
    	content: '';
    	content: none;
    }
    table {
    	border-collapse: collapse;
    	border-spacing: 0;
    }
    <div id="parent">
    <div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
        <div class="carousel-inner" role="listbox">
          <div class="carousel-item active">
            <video autoplay="true" loop muted class="d-block img-fluid" src="https://r1---sn-vgqs7nly.googlevideo.com/videoplayback?expire=1496618693&ratebypass=yes&lmt=1481043164463513&dur=59.350&pl=15&id=o-AL1AUoU6a3Nfcj7LH03aWUedATMzZser2fPJuYfXIks0&source=youtube&signature=4292002183801D0F3305E4F2C63F3CF53C6253E0.4BE60D1FB40096BD45D531BCDE2ECC2D39B0CDBA&key=cms1&mime=video%2Fmp4&requiressl=yes&ip=73.247.17.20&ei=ZEI0WcfDOoPPuALRm4-4DQ&sparams=dur,ei,expire,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source&ipbits=0&itag=22&redirect_counter=1&cm2rm=sn-vgqys7s&req_id=2b645fa084caa3ee&cms_redirect=yes&mm=34&mn=sn-vgqs7nly&ms=ltu&mt=1496597003&mv=m" type="video/mp4"></video>
          </div>
        </div>
      </div>
    </div>