说我有以下CSS和HTML代码:
#header {
height: 150px;
}Run Code Online (Sandbox Code Playgroud)
<div id="header">
<h1>Header title</h1>
Header content (one or multiple lines)
</div>Run Code Online (Sandbox Code Playgroud)
标题部分是固定高度,但标题内容可能会更改.我想将标题的内容垂直对齐到标题部分的底部,因此最后一行文本"粘贴"到标题部分的底部.
因此,如果只有一行文字,那就像:
-----------------------------
| Header title
|
|
|
| header content (resulting in one line)
-----------------------------
Run Code Online (Sandbox Code Playgroud)
如果有三行:
-----------------------------
| Header title
|
| header content (which is so
| much stuff that it perfectly
| spans over three lines)
-----------------------------
Run Code Online (Sandbox Code Playgroud)
怎么能在CSS中完成?
我在这里有一个非常简单的启动页面:http://iph0wnz.com
它的主图形位于中间,其次是我的'a'.右下方的徽标.我希望该徽标与整个页面的右下角对齐,这意味着如果页面中有很多文本内容,它会显示在所有内容之后(即它不会悬停在顶部),但是如果内容较少 - 就像现在一样 - 然后它应该与屏幕的最底部对齐,而不是在内容之后.
我将尝试给出一个文本示例,就像我在如何将div的内容对齐到底部一样?:
-----------------------------
| less content, no scroll |
| |
| |
| |
| a. |
----------------------------- (screen height)
和
-----------------------------
| more content, yes scroll |
| the quick brown fox jump- |
| ped over the lazy dog an- |
| d she sells sea shells on |
| the sea shore and some o- |
| ther random text is put …