微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么我的导航栏将我的文本隐藏在固定位置?

如何解决为什么我的导航栏将我的文本隐藏在固定位置?

我的网站有问题,当我将导航栏置于“固定”位置时,导航栏隐藏了下面部分的“h1”和“p”。我还有另一个问题是,对于我的网格,我希望照片和文本位于中心,但它不起作用。 你能告诉我更多吗?

enter image description here

.logo {
    width: 200px;
}
.navigation {
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: #fff;
}
.navbar-nav {
    margin: 0 auto;
    width: 100vw;
}

.nav-item .nav-link
{
    color: #1070b4;
    font-size: 25px;
    font-weight: bold;
    text-transform: uppercase; 
    text-decoration: none;
    border-bottom: 3px solid transparent;
    
}

.nav-link:hover {
    border-bottom: 3px solid #F48F17;
    color: #1d1d1d;
}
.citations {
    background: #1070b4;
}
.citations p {
    margin-top: 20px !important;
}
.citations-grid {
    width: 100%;
    max-width: 1290px;
    height: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill,625px);
    justify-content: center;
    grid-gap: 10px;
}
.paragraphe-citations {
    width: 625px;
    height: 300px;
}
.photo_beat {
    width: 500px;
    height: 400;
    border-radius: 20px;
    Box-shadow: 3px 3px 3px black;   
}
<body>
        <section>
            <header class="navigation">
                <div class="container">
                    <nav class="navbar navbar-expand-lg">
                        <!-- Brand -->
                        <a class="navbar-brand" href="#accueil"><img class="logo" src="img/Signature logo.png" alt="logo"/></a>
                  
                        <!-- Toggler/collapsibe Button -->
                        <button class="navbar-toggler bg-light navbar-light" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
                            <span class="navbar-toggler-icon"></span>
                        </button>
                  
                        <!-- Navbar links -->
                        <div class="collapse navbar-collapse" id="collapsibleNavbar">
                            <ul class="navbar-nav">
                                <li class="nav-item">
                                    <a class="nav-link" href="#accueil">Accueil</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#sound">Instrumentales</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#projets">Projets</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="#about">About</a>
                                </li>
                            </ul>
                        </div>
                    </nav>
                </div>
            </header>
        </section>

        <section>
            <div id="accueil" class="citations">
                <h1 class="grand-titre">Pierro a la Prod</h1>
                <p class="titre">Beatmaker et developpeur web</p>
                <div class="citations-grid">
                    <img class="photo_beat" class="paragraphe-citations" src="img/beatmaking1.jpg" alt="Photo Beatmaker"/>
                    <p class="paragraphe-citations">“La musique commence là où s'arrête le pouvoir des mots.” <br> - Richard Wagner <br> <br>“La musique est la langue des émotions.”<br> - emmanuel Kant <br><br> “La vie sans musique est tout simplement une erreur,une fatigue,un exil.” <br> - Friedrich Nietzsche </p>
                </div>
            </div>  
        </section>

解决方法

发生这种情况是因为固定属性从主流中删除了元素。您可以为引文 div 使用 margin-top 属性。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。