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

用户名

当内容比视口短时,我试图将页脚div保持在屏幕底部,但是当内容比视口高时,它也必须保留在页面内容的底部(而不是视口)。查看端口。

到目前为止,在放大时它仍位于内容的底部,但在缩小时我无法使其停留在底部。有些样本的位置是:绝对;我已经看到了,但是它使页脚保留在视口的底部,而不是放大时的内容。

我必须为学校单位执行此操作,有没有办法执行此操作?

现在我的页脚位置是相对的,尽管我想除了将其贴近最后一个div不会做任何事情,是吗?但是我似乎找到了我需要做的。

这是网站:http : //www.foodforthought.webatu.com/Index.html当您进行缩小时,您会看到页脚不在底部。

这是我的CSS:

* { padding: 0; margin: 0; font-family: verdana; }

html {
  height: 100%;
}


body {
font-size: 13px; 
color: #000; 
background-color: white;
background-position: center;
background-repeat: repeat-y; 
background-image: url('../images/background.jpg'); 

}

/* Main div container */
#wrapper {
margin: 0 auto;
width: 960px;
height: auto;
}

/* Header div */
#wrapper #header {
  height: 200px;
  background-color: green;

}

/* Special event section */
#header p {
position:relative ;
left: 30px;
top: -100px;
width: 300px;
z-index: 1;
color: white;
border-style: dashed;
padding: 5px;
border-width: 1px;
}

/* Horizontal list div */
#wrapper #navigation {
  height: 25px;
 background-color: white;
 display: block;

 }

/* Horizontal list */
#navigation ul {
 padding-top: 5px;
 list-style-type: none;
 text-align: center; 
 width: 960px

}

/* Horizontal list items */
#navigation li {
 display: inline-block;
 text-transform: uppercase;
 vertical-align: middle;
}

/* Horizontal list link */
#navigation a {
 height: 25px; 
 width: auto;
 display: block;
 line-height: 15px;
 text-align: center;
 vertical-align: middle;
 text-decoration: none;
 color: black;
 padding-left: 8px;
 padding-right: 8px;
}

/* Horizontal list hover attribute */
#navigation a:hover {
 color: Darkgrey;
 }


 /* Content div */
 #wrapper #content {
 display: inline-block;
 height: auto;
 width: 950px;
 background-color: white;
 padding-left: 10px;
 padding-right: 0px;
 }

/* Content headings */
#content h2 {
text-transform: capitalize;
padding: 10px;
}

/* Content image(global) */
#content img {
padding: 2px;
border-width: 1px;
margin: 10px;
margin-left: 20px;
Margin-right: 15px;
}

/* Content bullet list */
#content ul {
padding: 15px;
font-size: small;
margin-left: 10px;
}

/* Content paragraph text */
#content p {
padding-left: 10px;
font-size: small;
}

/* Content image */
#content #img1 {
float: left;
border-style: dashed;
}

/* Content image */
#content #img2 {
float: right;
border-style: solid;
border-width: 1px;
border-color: #BDA27E;
}

/* Content image */
#content #img3 {
float:left;
border-style:double;
margin-top: 20px;
margin-left: 8px;
border-width: 5px;
border-color: #996633;
}

/* Side menu div*/
#wrapper #content #menu {
 float: right;
 padding: 0px;
 margin: px;
 width: 220px;
 height: 1118px;
 }

/* Side menu*/
#menu ul {
 list-style-type: none;
 float: right;
 text-align: right; 
 width: 170px
}

#menu li {
background-image: url('../images/pg_menu_bg.png');
}


/* Side menu link */
#menu a {
 height: 30px; 
 display: block;
 vertical-align: middle;
 text-decoration: none;
 color: black;
 font-size: small;
 padding-top: 8px;
 margin-left: 10px;
 margin-right: 0px;
 }

/* Side menu hover attribute */
#menu a:hover {
color: darkgrey;
}

/* Footer div */
#wrapper #footer {
 height: 40px;
 background-color: #82AAF1;
 width: 960px;
 margin: 0px, auto;
 position: relative;
 bottom: 0;

}

/* Foot note */
#footer p {
text-align: center;
color: #6A1B1B;
padding-top: 15px;
font-size: 10px;
}

.padext {
padding-top:2px
}

对不起,我还是一个初学者。

谢谢您的时间。

瓦伦

如果您HTML是这样的:

<body>
<div id="wrapper">
    <div id="header"></div> 
    <div id="content"></div>
    <div id="footer"></div>
</div>

应用以下内容CSS

#wrapper {
min-height:100%;
position:relative;
}


#content {
padding:10px;
padding-bottom:80px;   /* Height of the footer element */
}

padding-bottom#content设置为页脚的高度。

#footer {
width:100%;
height:80px;
position:absolute;
bottom:0;
left:0;
}

我建议您参考以下链接:如何使用CSS使页脚位于页面底部

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

用tailwindCSS将页脚固定在底部

来自分类Dev

如何使页脚固定在底部?

来自分类Dev

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

来自分类Dev

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

来自分类Dev

使元素固定在屏幕底部

来自分类Dev

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

来自分类Dev

不要将页脚固定在底部

来自分类Dev

页脚未固定在页面底部

来自分类Dev

GADBannerView固定在UITableViewController屏幕底部

来自分类Dev

Android页脚固定在底部,将位于其他视图之上

来自分类Dev

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

来自分类Dev

如何在调整大小时将html元素固定在窗口的底部,而不是在滚动时将其固定在窗口的底部?

来自分类Dev

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

来自分类Dev

滚动时如何将表单元素固定在显示的屏幕底部?

来自分类Dev

如何将AppBar固定在底部

来自分类Dev

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

来自分类Dev

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

来自分类Dev

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

来自分类Dev

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

来自分类Dev

是否可以将UIView的顶部固定在导航栏的底部?

来自分类Dev

缩小时页脚div移动

来自分类Dev

无法将页脚放在页面底部

来自分类Dev

如何使STICKY表单内的页眉和页脚(即分别固定在表单的顶部和底部)?

来自分类Dev

将页脚固定到页面底部(无页眉)

来自分类Dev

将容器流体固定在固定顶部和固定底部之间

来自分类常见问题

如何将页脚保持在屏幕底部

来自分类Dev

如何使用jQuery将页脚保持在屏幕底部

来自分类Dev

电子:将浏览器窗口固定在屏幕侧面

来自分类Dev

屏幕缩小时将框从右移到顶部

Related 相关文章

  1. 1

    用tailwindCSS将页脚固定在底部

  2. 2

    如何使页脚固定在底部?

  3. 3

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

  4. 4

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

  5. 5

    使元素固定在屏幕底部

  6. 6

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

  7. 7

    不要将页脚固定在底部

  8. 8

    页脚未固定在页面底部

  9. 9

    GADBannerView固定在UITableViewController屏幕底部

  10. 10

    Android页脚固定在底部,将位于其他视图之上

  11. 11

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

  12. 12

    如何在调整大小时将html元素固定在窗口的底部,而不是在滚动时将其固定在窗口的底部?

  13. 13

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

  14. 14

    滚动时如何将表单元素固定在显示的屏幕底部?

  15. 15

    如何将AppBar固定在底部

  16. 16

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

  17. 17

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

  18. 18

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

  19. 19

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

  20. 20

    是否可以将UIView的顶部固定在导航栏的底部?

  21. 21

    缩小时页脚div移动

  22. 22

    无法将页脚放在页面底部

  23. 23

    如何使STICKY表单内的页眉和页脚(即分别固定在表单的顶部和底部)?

  24. 24

    将页脚固定到页面底部(无页眉)

  25. 25

    将容器流体固定在固定顶部和固定底部之间

  26. 26

    如何将页脚保持在屏幕底部

  27. 27

    如何使用jQuery将页脚保持在屏幕底部

  28. 28

    电子:将浏览器窗口固定在屏幕侧面

  29. 29

    屏幕缩小时将框从右移到顶部

热门标签

归档