简体   繁体   English

在HTML / CSS中放置页脚时遇到问题

[英]Having Trouble With Positioning The Footer in HTML/CSS

i have a page with some contents and a footer at the bottem. 我在页面上有一个包含一些内容和页脚的页面。 but there is a problem with the footer. 但是页脚有问题。 my footer sticks to the contents and do not stay at the bottom. 我的页脚坚持内容,不要停留在底部。 when i use a position:relative for the body and a position:absolute; 当我使用身体的position:relativeposition:absolute时; bottom:0; 底部:0; for the footer it sticks to the bottom but when i zoom and scroll down it is in the middle of the page. 对于页脚,它停留在底部,但是当我缩放和向下滚动时,它位于页面的中间。 how can i fix this problem? 我该如何解决这个问题?

here is my code for the body: 这是我的身体代码:

width: 100%;
padding: 0;
margin: 0;
background: -webkit-linear-gradient(left,#000 0%,#222 100%);
background: -moz-linear-gradient(left,#000 0%,#222 100%);
background: -ms-linear-gradient(left,#000 0%,#222 100%);
background: -o-linear-gradient(left,#000 0%,#222 100%);
background: linear-gradient(left,#000 0%,#222 100%);
min-width: 970px;
position: relative;

and here is my code for the footer: 这是我的页脚代码:

color: rgba(255,255,255,0.8);
text-align: center;
font-family: roya;
font-size: 0.9em;
letter-spacing: 0.07em;
line-height: 0.5em;
position: absolute;;
left: 0;
bottom: 0;
width: 100%;
min-width: 970px;
height: 65px;
clear: both;
background: #222;
border-top: 2px solid #666;
border-radius: 100px 100px 0 0;
margin: 0;

another thing is: my page usually doesn't have scrolling at all exept some small devices 另一件事是:我的页面通常根本没有滚动,只有一些小型设备

您是否尝试将body设置为{height:100%;}?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM