为什么我的页脚没有固定在页面底部?

车21

我不知道为什么页脚div不停留在页面底部?理想情况下,内容div应随其内部的实际内容量一起扩展,并且页脚应始终位于底部。我究竟做错了什么?

* {
  margin: 0 auto;
  font-family: 'Raleway', sans-serif;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  -o-transition: all 0.2s ease;
  -ms-transition: all 0.2s ease;
  transition: all 0.2s ease;
}
.wrapper {
  width:960px;
  min-height: 570px;
  margin:0 auto;

}
.header{
  height:60px;
}
.nav {
  height:30px;
  border: 1px solid rgb(0,0,0);
  border-left:
  border-right:
}
.content {
  width:100%;

}
.mainContent{
  width:755px;
  height:500px;
  border: 1px solid rgb(0,0,0);
  border-top: 0;
  float:left;
  overflow:hidden;
  z-index: 0;
}
.sidebar{
  width: 200px;
  height:500px;
  border: 1px solid rgb(0,0,0);
  border-top:0;
  border-left: 0;
  float:right;
}
.footer{
  height:100px;
  width:958px;
  border:1px solid rgb(50, 50, 50);
  border-bottom: 0;
  position: absolute;
  bottom:0;
  color:white;
  background-color: rgb(60,60,60);
}
.clear{
  clear:both;
}
li{
  display:inline-flex;
  padding:5px 40px 10px 40px;
}
input{
  position: absolute;
  top: -9999px;
  left: -9999px;
}
label {
  height:15px;
  width:30px;
  color:red;
  background-color: white;
  padding: 10px 20px 0px 20px;
  border:1px solid rgb(0,0,0)
  position:absolute;
  bottom:0;
  right:0;
}
input#Color {
  position:absolute;
}
input#Color:checked + .wrapper {
  background-color: rgb(0,0,0);
  -webkit-background-color: rgb(0,0,0);
}
input#Color:checked + * {
  background-color: rgb(0,0,0);
  -webkit-background-color: rgb(0,0,0);
  color:red;
}
input#Color:checked + .wrapper .nav {
  -webkit-background-color: rgb(0,0,0);
  border: 1px solid rgb(255, 0, 0);
}
input#Color:checked + .wrapper .content .mainContent {
  -webkit-background-color: rgb(0,0,0);
  border: 1px solid rgb(255, 0, 0);
  border-top: 0;
  color:red;
}
input#Color:checked + .wrapper .footer {
  background-color: rgb(0,0,0);
  -webkit-background-color: rgb(0,0,0);
  border: 1px solid rgb(255, 0, 0);
  color:red;
  border-bottom: 0;
}
<!DOCTYPE html>
<!-- DOCKMANN INDEX PAGE - CODE: D001 -->
<html>
<head>
<!-- CSS --><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<!-- JS --><script src="script.js"></script>

<link href="https://fonts.googleapis.com/css?family=Raleway:300" rel="stylesheet">
</head>
    <!-- END HEAD -->
<body>
  <label for="Color">Red Eye</label>
  <input type="checkbox" id="Color"/>
 <div class="wrapper">
    <div class="header">

      test header
    </div>
    <!-- end header -->
    <div class="nav">
          <ul>
            <li>
              HOME
            </li>
            <li>
              ALBUM
            </li>
            <li>
              FILMS
            </li>
            <li>
              SOCIAL
            </li>
            <li>
              CONTACT
            </li>
          </ul>
    </div>
    <!-- end nav -->
    <div class="content">
          <div class="mainContent">
            mainContent
          </div>
          <div class="sidebar">
            Sidebar
          </div>
    </div>
    <!-- end content -->
    <div class="footer">
      test footer
    </div>
    <!-- end footer -->
 </div>
 <!-- end wrapper -->
</body>
</html>

XYZ

您必须position:fixed让它停留在页面的底部position:absolute。将页脚的更改为,position:fixed以便始终将其固定在底部或

.wrapper {
width:960px;
 min-height: 570px;
margin:0 auto;
position:relative;
}

因此页脚将相对于包装器定位

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

页脚未固定在页面底部

来自分类Dev

如何使页脚固定在底部?

来自分类Dev

JQUERY:为什么向下滚动时我的导航仪没有固定在顶部?

来自分类Dev

为什么页脚不跳到页面底部?

来自分类Dev

使用Bootstrap 3使页脚固定在底部

来自分类Dev

不要将页脚固定在底部

来自分类Dev

用tailwindCSS将页脚固定在底部

来自分类Dev

为什么页面底部没有裁剪我的绝对定位元素

来自分类Dev

根据高度将网站页脚固定在页面底部还是下方?

来自分类Dev

为什么我的页脚没有从html的边缘增加?

来自分类Dev

固定在页面底部的可滚动元素

来自分类Dev

我想将页脚固定在内容的底部(而不是屏幕),以便将其全部放在一个div中吗?有任何想法吗?

来自分类Dev

在页面底部或文本下方固定页脚

来自分类Dev

将页脚放在页面底部,但不固定

来自分类Dev

缩小时无法将页脚固定在屏幕底部

来自分类Dev

如何使用“ position:absolute”将页脚固定在div的底部?

来自分类Dev

如何使用绝对位置将页脚固定在底部?

来自分类Dev

为什么我的 html 文件在底部/页脚加载

来自分类Dev

为什么页脚不在底部

来自分类Dev

为什么我的路线没有指向我的页面?

来自分类Dev

为什么我的路线没有指向我的页面?

来自分类Dev

为什么我的屏幕没有锁定在XFCE中?

来自分类Dev

为什么我没有收到phantomjs页面响应?

来自分类Dev

为什么我的php页面没有发送邮件

来自分类Dev

为什么我没有看到预期的页面错误?

来自分类Dev

Bootstrap中的页脚,该页脚随内容扩展或固定在底部

来自分类Dev

有没有一种方法可以使材料ui抽屉固定高度(并固定在底部)

来自分类Dev

Div,固定在底部,固定在顶部

来自分类Dev

固定的页脚在滚动到页面底部时会扩展

Related 相关文章

  1. 1

    页脚未固定在页面底部

  2. 2

    如何使页脚固定在底部?

  3. 3

    JQUERY:为什么向下滚动时我的导航仪没有固定在顶部?

  4. 4

    为什么页脚不跳到页面底部?

  5. 5

    使用Bootstrap 3使页脚固定在底部

  6. 6

    不要将页脚固定在底部

  7. 7

    用tailwindCSS将页脚固定在底部

  8. 8

    为什么页面底部没有裁剪我的绝对定位元素

  9. 9

    根据高度将网站页脚固定在页面底部还是下方?

  10. 10

    为什么我的页脚没有从html的边缘增加?

  11. 11

    固定在页面底部的可滚动元素

  12. 12

    我想将页脚固定在内容的底部(而不是屏幕),以便将其全部放在一个div中吗?有任何想法吗?

  13. 13

    在页面底部或文本下方固定页脚

  14. 14

    将页脚放在页面底部,但不固定

  15. 15

    缩小时无法将页脚固定在屏幕底部

  16. 16

    如何使用“ position:absolute”将页脚固定在div的底部?

  17. 17

    如何使用绝对位置将页脚固定在底部?

  18. 18

    为什么我的 html 文件在底部/页脚加载

  19. 19

    为什么页脚不在底部

  20. 20

    为什么我的路线没有指向我的页面?

  21. 21

    为什么我的路线没有指向我的页面?

  22. 22

    为什么我的屏幕没有锁定在XFCE中?

  23. 23

    为什么我没有收到phantomjs页面响应?

  24. 24

    为什么我的php页面没有发送邮件

  25. 25

    为什么我没有看到预期的页面错误?

  26. 26

    Bootstrap中的页脚,该页脚随内容扩展或固定在底部

  27. 27

    有没有一种方法可以使材料ui抽屉固定高度(并固定在底部)

  28. 28

    Div,固定在底部,固定在顶部

  29. 29

    固定的页脚在滚动到页面底部时会扩展

热门标签

归档