Chrome导航栏消失时阻止页面调整大小

时间:2017-02-05 03:18:13

标签: html css image google-chrome responsive

一旦Chrome浏览器的导航栏出现或消失,我的背景图片就会调整大小。如何摆脱它?

很难解释(作为瑞士人)。请查看此GIF:gif]

HTML

<div id="top-screen">
        <div id="top-heading">
            <img src="assets/img/logo_white.png" alt="Logo">
            <h1>Title</h1>
            <h2>Professionelle Fahrzeugfolierungen</h2>
            <nav>
                <ul>
                    <a href="#services"><li>Services</li></a>
                    <a href="#foils"><li>Folien</li></a>
                    <a href="#pricing"><li>Preise</li></a>
                    <a href="#"><li>Über mich</li></a>
                    <a href="#contact"><li>Kontakt</li></a>
                    <a href="#map"><li>Anfahrt</li></a>
                </ul>
            </nav>
        </div>
        <a href="#"><div class="scroll"></div></a>
    </div>

CSS

html, body {
    height:100%;
}

body {
    padding:0;
    margin:0;
}

/* END GENERAL */

/* START TOP SCREEN */

#top-screen {
    min-height: 100%;
    background-color: #1e1e1e;
    background-image: url(https://picload.org/image/rocorlil/topheader.jpg);
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: top center;
    color: #fff;
    text-align: center;
    position: relative;
    -webkit-transition: padding-top 0.2s linear 0s;
    -moz-transition: padding-top 0.2s linear 0s;
    -o-transition: padding-top 0.2s linear 0s;
    transition: padding-top 0.2s linear 0s;
    height: 90%; 
    width:100%;
    display:flex;
    align-items: center;
    justify-content: center;
}

#top-screen #top-heading img {
    width:200px;
}

#top-screen #top-heading h1 {
    font-family:Lato;
    font-size:3.75rem;
    color:#FFF;
    font-weight:900;
    margin:0;
    text-transform:uppercase;
}

#top-screen #top-heading h2 {
    font-family:Montserrat;
    font-size:0.9375rem;
    color:#FFF;
    margin:0;
    text-transform:uppercase;
    font-weight:400;
    letter-spacing:0.14125rem;
    line-height:1px;
}

#top-screen #top-heading nav {
    width:440px;
    margin-top:20px;
}

#top-screen #top-heading ul {
    list-style-type:none;
    margin:0;
    padding:0;
    transition:all 0.3s ease;
}

#top-screen #top-heading ul li {
    width:130px;
    height:35px;
    background:#703030;
    font-family:Montserrat;
    color:#FFF;
    font-size:0.9375rem;
    text-transform:uppercase;
    line-height:35px;
    display:inline-block;
    margin: 5px;
    transition:background 0.3s ease;
}

#top-screen #top-heading ul li:hover {
    background:#7F827B;
}

#top-screen .scroll {
    position: absolute;
    left: 50%;
    bottom: 0;
    height: 0;
    width: 0;
    border-left: 90px solid transparent;
    border-right: 90px solid transparent;
    border-bottom: 80px solid #ECF0F1;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
}

#top-screen .scroll:before {
    content: '';
    position: absolute;
    top: 45px;
    left: 50%;
    height: 20px;
    width: 30px;
    margin-top: -5px;
    margin-left: -15px;
    background:#703030;
    -webkit-clip-path: polygon(15% 0, 50% 60%, 85% 0, 100% 20%, 50% 100%, 0 20%);
    clip-path: polygon(15% 0, 50% 60%, 85% 0, 100% 20%, 50% 100%, 0 20%);
}

这是我的代码:https://jsfiddle.net/Vringe/4ur5nuec/5/

直接链接(用于在手机上进行测试):https://jsfiddle.net/Vringe/4ur5nuec/5/embedded/result/

0 个答案:

没有答案