视频div和文本div

时间:2016-01-12 09:02:39

标签: html css class video nav

我一直在努力,但没有任何作用,我在互联网上找到的一切都不适合我。我有一个名为“vidContain”的div中的视频,在这个div下面是另一个名为“about”的文本div。在“vidContain”div之间是一个身份不明的白色空间,白色空间只有4px小。有人能告诉我我做错了吗?

HTML CODE

<div class="nav">
            <ul>
                <li><a href="#vidContain">Home</a></li>
                <li><a href="#about">About</a></li>
                <li><a href="#services">Services</a></li>
                <li><a href="#blog">Blog</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </div>

        <div id='vidContain'>
            <div id='vid'>
                <video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">
                    <source src="video/finlay.mp4" type="video/mp4">
                    </video>
            </video>
            </div>
        </div>

        <div id="about">
            <p>Lorem ipsum</p>
        </div>

        <div id="services">
            Lorem ipsum
        </div>

        <div id='blog'>
            Lorem Ipsum
        </div>

CSS代码

@font-face {
    font-family: 'Brandon Grotesque';
    src: url('BrandonGrotesque-Regular.eot');
    src: url('BrandonGrotesque-Regular.eot?#iefix') format('embedded-opentype'),
        url('BrandonGrotesque-Regular.woff') format('woff'),
        url('BrandonGrotesque-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Brandon Grotesque';
    src: url('BrandonGrotesque-Bold.eot');
    src: url('BrandonGrotesque-Bold.eot?#iefix') format('embedded-opentype'),
        url('BrandonGrotesque-Bold.woff') format('woff'),
        url('BrandonGrotesque-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

html, body { 
    width:100%; 
    height:100%; 
    margin:0; 
    padding:0; 
}

.nav {  
    z-index:10000;
    margin-top: 10px;
    width: 100%;
    font-family: Lucida Console,Lucida Sans Typewriter,monaco,Bitstream Vera Sans Mono,monospace;
    position: fixed;
    text-align:right;
}

.nav ul {
    width: 100%;
    margin: 0;
    padding: 0;
    letter-spacing: 4px;
}

.nav ul li {
    display: inline;
}

.nav ul li a{
    text-decoration: none;
    color: black;
    padding: 0;
    text-transform: uppercase;
}


.nav ul li a:hover, .nav ul li .current{
    color: #ffeead;
}

#vidContain {
    position:relative;
    display:inline-block;
    margin:0px;
}
#vid {
    top: 0; left:0;
    width: 100%; height: auto; 
    z-index: -1;
    display: block;
}

h1{
    font-weight: bold;
    letter-spacing: 6px;
}

h2{
    font-weight: normal;
    font-size: 18px;
    color:grey;
}

#about{
    margin: 0;
    padding: 0;
    height:500px;
    background-color: #4f444c;
}

#services{
    margin: 0;
    padding: 0;
    height:500px;
    background-color: white;
}

#blog{
    margin: 0;
    padding: 0;
    height:500px;
    background-color: #ffeead;
}

video{
    display: block;
    margin:0;
}

2 个答案:

答案 0 :(得分:1)

此ID #vidContain添加property vertical-align: top;&amp;将此媒体资源添加到p margin:0;

还有两次关闭视频标签

https://jsfiddle.net/wuoaLLsy/

答案 1 :(得分:0)

这是一个在黑暗中的镜头,没有看到小提琴或什么东西,看看究竟发生了什么,但你有两个关闭</video>标签...尝试删除一看是否有所作为:

<div id='vidContain'>
       <div id='vid'>
           <video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">
                    <source src="video/finlay.mp4" type="video/mp4">
           </video>
      </div>
 </div>