如何粘贴文本到页面的底部? [英] How to stick a text to the bottom of the page?

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

问题描述

我想在页面底部添加一行All Rights Reserved ...。
我试图使用绝对定位,但是当窗口调整到较小的高度时,这不会按预期工作。

I would like to put a line "All Rights Reserved..." at the bottom of the page. I tried to use absolute positioning, but this does not work as expected when the window resized to smaller height.

如何实现这个简单的目标? / p>

How can I achieve this simple goal ?

推荐答案

您可能希望将绝对对齐的div放在一个相对对齐的容器中 - 这样,它仍将包含在容器中

You might want to put the absolutely aligned div in a relatively aligned container - this way it will still be contained into the container rather than the browser window.

<div style="position: relative;background-color: blue; width: 600px; height: 800px;">    

    <div style="position: absolute; bottom: 5px; background-color: green">
    TEST (C) 2010
    </div>
</div>

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

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