html - 视频 div 和文本 div 之间的空白

标签 html css class video nav

我已经尝试了很多但没有任何效果,我在互联网上找到的所有内容都不适合我。我有一个名为“vidContain”的 div 内的视频,在这个 div 下方是另一个名为“about”的文本 div。 “vidContain”div 之间是一个未识别的空白,空白只有 4px 小。有人可以告诉我我做错了什么吗?

HTML 代码

<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;
}

最佳答案

此 id #vidContain 添加 property vertical-align: top; 并将此属性添加到 p margin:0;

还有两次关闭视频标签

https://jsfiddle.net/wuoaLLsy/

关于html - 视频 div 和文本 div 之间的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34739309/

相关文章:

javascript - 从菜单中隐藏/显示多个 div

.net - 在 .NET 中生成简单报告的模板引擎

python - 模拟 python 类属性的类似指针的行为

jquery - 如何使用 jQuery 覆盖(已经)定义的带有嵌套 anchor 标记的 DIV 类的 CSS 样式?

php readFile() 和移动 safari

javascript - 使用 div 提交表单

html - 我的文本区域干扰了表格中的其他 td 元素

css - 为 div 创建动态高度

css - 避免与 CSS 网格重叠元素(在 IE11 中)

java - 手动向类文件添加方法调用?