Say I have the following CSS and HTML code:
(说我有以下CSS和HTML代码:)
#header { height: 150px; }
<div id="header"> <h1>Header title</h1> Header content (one or multiple lines) </div>
The header section is fixed height, but the header content may change.
(标头部分的高度固定,但是标头内容可能会更改。)
I would like the content of the header to be vertically aligned to the bottom of the header section, so the last line of text "sticks" to the bottom of the header section.
(我希望标题的内容与标题部分的底部垂直对齐,因此文本的最后一行“粘贴”到标题部分的底部。)
So if there is only one line of text, it would be like:
(因此,如果只有一行文本,则将是:)
-----------------------------
| Header title
|
|
|
| header content (resulting in one line)
-----------------------------
And if there were three lines:
(如果有三行:)
-----------------------------
| Header title
|
| header content (which is so
| much stuff that it perfectly
| spans over three lines)
-----------------------------
How can this be done in CSS?
(如何在CSS中完成此操作?)
ask by kristof translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…