如何将页脚放在可见页面的底部? [英] How to put the footer at the bottom of the visible page?

查看:58
本文介绍了如何将页脚放在可见页面的底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更改Openx实现,并添加了页脚.它总是在底部,如果页面太长,则需要向下滚动才能看到页脚.但是我想做的是将页脚放在可见部分的底部.您知道就像他们在底部放置烦人的横幅一样,即使您向下滚动或向上滚动,它也仍然存在.我不知道名字现在,页脚位于底部.不在div内,因此它始终在底部.但是,是否有一种方法可以使它准确定位页面可见部分的大小?我的英语不足以告诉您我的意思.我现在英语有些麻烦.关于如何做到这一点的任何想法?这是页脚的CSS;

I am changing the Openx implementation and I added a footer. It is always in the bottom and if the page is too long, you need to scroll down to see the footer. But what I am trying to do is, putting the footer in the bottom of the visible part. You know like they put annoying banners right in the bottom and even when you scroll down or up, it is still there. I don't know the name of it. Right now, the footer is in at the bottom. Not inside a div so it is always in the bottom. But, is there a way to make it position exactly the size of the page's visible part? My English is not enough to tell you what I mean I think. I am having some trouble with English right now. Any ideas about how to do that? This is the footer's css;

 .footer{
    position: relative;
    margin-top:-100px;
}

它的位置就像

<body>
    some divs..

    <div class="footer">
    </div>

</body>

我应该将页脚放在上面的一个格中吗?我试过了,但是没有用.也许位置应该相对于页面的可见高度?

should I put the footer in one div above? I tried it but it didn't work. Maybe the position should be relative to page's visible height?

推荐答案

尝试以下CSS

.footer{
    width:100%;
    position:fixed;
    bottom:0px;
}

并确保您的页脚div是最后一个div.

And make sure your footer div is the last div.

固定的位置即使浏览器窗口滚动也可以使您的页脚停留在同一位置

The position fixed makes your footer stay at the same place even if the browser window is scrolled

这篇关于如何将页脚放在可见页面的底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆