为什么section大于fullpage.js的窗口?

时间:2016-12-20 21:50:57

标签: javascript html css footer fullpage.js

我使用fullpage.js扩展程序来实现自动滚动。我创建了一个页脚并将其放在页面底部。但是,它并没有显示,因为该部分(由绿色边框表示)大于窗口,如下所示。

enter image description here

当我关闭自动滚动时,我发现页面底部的页脚如下所示。

enter image description here

我认为fullpage.js部分假设占用了窗口的大小,为什么会发生这种情况?如何解决这个问题?

HTML:

<div class = "section contact" anchor = "4thPage">
            <ul>
                <!-- buttons for GitHub, LinkedIn, Resume-->
           </ul>
            <div class = "footer"> © 2016 Full Name. All rights reserved. </div>
</div>

CSS:

.footer {
    bottom: 0;
    position: absolute;
}

.contact {
    text-align: center;
    padding-top: 5%;
    position: relative;
}

1 个答案:

答案 0 :(得分:1)

您可能没有使用box-sizing: border-box

Reproduction online

.content{
    position:absolute;
    border: 20px solid red;
    bottom:0;
    top:0;
    width: 100%;
      box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

HTML

<div class="section">
    <div class="content">
        One
    </div>
</div>
相关问题