我的页脚没有出现在页面底部,而是出现在页面中间

杀手王子182

我的页脚没有出现在页面的末尾。它出现在中间。我已经尝试了其他人在类似问题上给出的所有其他答案,但效果不佳。

这是我的 html:-

<body>
    <div class="nav-container">
    </div>

    <div class="hero-area">
    </div>


    <div class="main-container">

        <section id="about">
        </section>

        <section id="services">
        </section>

        <section id="portfolio">
        </section>

        <section id="contact">
        </section>

    </div>


    <ul class="social-items">
        <li>FACEBOOK</li>
        <LI>INSTAGRAM</LI>
        <LI>YOUTUBE</LI>
    </ul>

    <footer>
        <h1>This is footer!</h1>
    </footer>

</body>

我的页脚出现在投资组合区域内的任何地方。这是我的 sass:-

body {
  padding: 0;
  margin: 0;
  font-family: "Open Sans", sans-serif;
  color: $light-mode;
  background: $dark-mode;
  @include dark-white-transition;
  overflow-x: hidden;
  min-height: 100%;
  position: relative;
}

footer {
  background: $dark-mode;
  padding: 60px 30px;
  color: $light-mode;
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  margin-bottom: 0;
  width: 100%;
}
拉斐尔·戴安娜

将宽度和高度属性添加到 html 标签可以解决问题。

html {
  height:100%;
  width:100%;
}

body {
  padding: 0;
  margin: 0;
  font-family: "Open Sans", sans-serif;
  color: #f00;
  background: #0f0;
  overflow-x: hidden;
  height: 100%;
  position: relative;
}

footer {
  background: #00f;
  padding: 20px 30px;
  color: #0ff;
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  margin-bottom: 0;
  width: 100%;
}

ul {
  margin:0;
}
<body>
    <div class="nav-container">
    </div>

    <div class="hero-area">
    </div>


    <div class="main-container">

        <section id="about">
        </section>

        <section id="services">
        </section>

        <section id="portfolio">
        </section>

        <section id="contact">
        </section>

    </div>


    <ul class="social-items">
        <li>FACEBOOK</li>
        <LI>INSTAGRAM</LI>
        <LI>YOUTUBE</LI>
    </ul>

    <footer>
        <h1>This is footer!</h1>
    </footer>

</body>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

有没有办法让html页脚出现在任何页面的底部?

导航栏没有出现在我的页面顶部,出现在怪异的地方

页脚一直出现在页面中间

Slick Carousel 没有出现在 Boostrap 页面上

jQuery Mobile IOS仅发生弹性滚动,而没有出现在页面底部

页脚出现在屏幕中间

Mat-option出现在页面底部,而不是出现在mat-select下

css 文件没有出现在我的实时 github 页面应用程序中

谷歌页面没有出现在我的电子应用程序中

GIF 背景图片没有出现在我的页面上

我在 GITHUB 页面上部署项目没有出现在浏览器上

为什么 JQuery UI 滑块没有出现在我的页面上?

水平滚动条仅出现在页面底部

Bootstrap下拉菜单出现在页面底部

使按钮出现在页面引导程序的中间

如何使 php 页脚不出现在我网站的特定页面上?

提交div没有出现在底部

Vue/MySQL 数据库没有出现在网上,而是出现在本地?

当内容出现在底部时,使页脚向上移动

为什么相关的帖子小部件仅出现在页脚部分,而没有出现在侧边栏中?

为什么我的组件没有以代号1出现在HTML页面或Media Player的顶部

如何让我的输入值出现在我所有的 html 页面中?

背景图片没有出现在 github 页面上

hdmi没有出现在xrandr

hdmi没有出现在xrandr

模态没有出现在点击

AdMob没有出现在我的SpriteKit游戏中

QRectF没有出现在我的QGraphicsScene中

Entry() 没有出现在我的程序中