【问题标题】:Issue with content scrolling over banner and under header内容在横幅和标题下滚动的问题
【发布时间】:2015-04-18 18:53:21
【问题描述】:

所以我有这个固定的标题,它有z-index:10,下面是一个固定的横幅,然后下面是一个相对的内容容器。我想要的是内容在横幅上方但在标题下方滚动。但是,当我尝试滚动时,它不起作用。对我来说奇怪的是,每当我将 box-shadow: 0px 0px 2px rgb(100,100,125); 添加到内容容器时,它都会做我想做的事。我正在使用以下代码:

* {
    padding: 0;
    margin: 0 auto;
}

body {
    background: rgb(223,227,238);
    text-align: center;
}

#body_container {
    padding-top: 80px;
}

#banner_container {
    position: fixed;
    left: 0;
    right: 0;
}

#banner {
    width: 1024px;
    height: 300px;
}

#content_container {
    background: rgb(243,247,248);
    max-width: 1024px;
    height: 100%;
    position: relative;
    top: 300px;
    box-shadow: 0px 0px 2px rgb(100,100,125);
}

header {
    min-width: 100%;
    background: rgb(50,50,50);
    height: 80px;
    position: fixed;
    z-index: 10;
}

/* Header styling, not relevant */
#header_container {
    max-width: 1024px;
    height: 100%;
}

#header_container div {
    float: left;
    display: inline-block;
    width: 25%;
}

#logo {
    width: 50%;
    height: auto;
}

.menuItem {
    padding-top: 29px;
    height: calc(100% - 29px);
    border: 0;
    text-align: center;
    font-family: Signika;
    font-size: 25px;
    color: rgb(203,207,218);
}

.menuItem:hover {
    border-bottom: 4px solid rgb(59,89,202);
    height: calc(100% - 33px);
    color: rgb(160,170,218);
}

.menuLogo {
    padding-top: 14.5px;
    height: calc(100% - 14.5px);
    border: 0;
    text-align: center;
}

#mobile_menu_button {
    display: none;
}
<header>
    <div id="header_container">
        <div class="menuLogo">
            <img id="logo" src="img/desygn%20logo%20website.png">
        </div>
        <div class="menuItem">Home</div>
        <div class="menuItem">Over</div>
        <div class="menuItem">Contact</div>
                
        <div id="mobile_menu_button">
                    
        </div>
    </div>
</header>
        
<div id="body_container">
    <div id="banner_container">
        <img id="banner" src="img/banner_website.png">
    </div>
            
    <div id="content_container">
    </div>
</div>

【问题讨论】:

    标签: html css


    【解决方案1】:

    在您的代码中,您没有在content_container 下添加任何内容。我没有看到您的代码有任何问题。它工作正常。检查here的内容

    【讨论】:

    • 嗯,你是对的,这似乎是一个 Safari 唯一的问题。知道如何解决这个问题吗?我在 Firefox 中加载了没有 box-shadow 的同一个文件,它就像一个魅力。
    • 同样,它在 safari 中也能正常工作。您在 Safari 中遇到了什么问题,而不是在其他浏览器中?
    • 你可以看到我看到的here,较轻的部分是content_container(顺便说一句,这是一个截图,没有显示整个页面,但它显示了你需要看到的内容)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多