A simple question for a simple problem. I'm working on a way to represent textual documents (such as book pages) with relatively simple HTML underlying them. Each HTML document can display many pages. The biggest problem I've run into is the footer. I want it to be simple, of course; perhaps just a <FOOTER> tag with plain text within it. However, I can't fathom how to force it to stay at the bottom of its page no matter how much text precedes it. Is there any way to pin an HTML element to the bottom of another?

一个简单问题的简单问题。我正在研究一种表示文本文档(例如书页)的方法,其中包含相对简单的HTML。每个HTML文档都可以显示许多页面。我遇到的最大问题是页脚。当然,我希望它很简单;也许只是一个带有纯文本的

标签。但是,我无法理解如何强制它停留在页面的底部,无论它前面有多少文本。有没有办法将HTML元素固定到另一个的底部?

Here's an example:

这是一个例子:

http://prog.bhstudios.org/documents.htm

position:relative doesn't work because I don't know where the original position of the footer will be, other than "somewhere within its parent".

position:relative不起作用,因为我不知道页脚的原始位置在哪里,除了“在其父级内的某个地方”。

position:absolute; bottom:0 doesn't work because that's relative to the viewing window's topleftmost position, not to the element's parent

位置:绝对的; bottom:0不起作用,因为它相对于查看窗口的最左侧位置,而不是元素的父级

position:fixed; bottom:0 doesn't work because that takes it out of the flow and 'pins' it to the bottom of the viewing window, completely independent of the element's parent.

位置是:固定; bottom:0不起作用,因为它将其从流中取出并将其“固定”到查看窗口的底部,完全独立于元素的父级。

I want something that works as one would expect float:bottom might work.

我想要一些可以预期漂浮的东西:底部可能有效。

1 个解决方案

#1


7

I was just working on similar thing:

我只是在做类似的事情:

<div style="position: relative; height: 300px;">
    <h1>some content on top</h1>

    <div style="position: absolute; bottom: 0px; background: #cccccc;">
        this is on bottom!
    </div>
</div>

更多相关文章

  1. 图标旋转但返回上一个位置
  2. 如何根据容器更改元素的宽度?
  3. 通过属性名称获取HTML元素
  4. Jquery在两个元素之间更改文本
  5. HTML哪些是块级元素,哪些是行内元素、
  6. 如何使用CSS消除元素的偏移?
  7. KeyPress或KeyDown事件没有得到html元素的buind
  8. 行内元素与块级元素
  9. 固定定位,父元素具有转换

随机推荐

  1. Spark RDD算子/SparkSQL分别实现对电影数
  2. SQL中带闭包表的有向循环图
  3. CentOS下mysql启动失败
  4. Sqlserver 链接服务器和同义词
  5. Python SQLITE数据库操作简便易用 (转)
  6. PHP“智能”搜索引擎搜索Mysql表的建议
  7. 关于NavicatPremium导入CSV文件乱码的问
  8. 查询表中的某一行,表中没有行号相关的属性
  9. 在VS下用C语言连接SQLServer2008
  10. 基于GUI和SQL的剧院票务管理系统