本文介绍了CSS文本对齐容器的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张标题,一面有大图像,另一面有一小段文字。我希望段落在标题div的底部开始。如果段落中有5行,我希望最后一行位于标题的底部。
I have a header which has a large image floated on one side, and a small paragraph of text on the other side. I want the paragraph to start at the bottom of the header div. If there were 5 lines in the paragraph, I want the last line to be at the bottom of the header. I'm having trouble getting the paragraph to align itself down there.
我有这样的事情:
<div id='header'> <img id='logo' /> <p id='quote'></p> </div>而CSS是:
And the CSS is:
div#header { height: 200px; } div#header img#logo { float: left; } p#quote { float: left; }推荐答案
jsfiddle/danheberden/ymwPe/
<div id="container"> <div id="gonnaBeOnTheBottom"> <p>Hi there!</p> <p>I'm on the bottom!</p> </div> </div>css:
#container { background: #EEE; height:400px; width:400px; position:relative; } #gonnaBeOnTheBottom { position:absolute; bottom:0; }通过设置 position:relative 在父容器上,你可以在其中放置绝对位置元素:)
by setting position:relative on the parent container, you can absolute position elements inside of it :)
更多推荐
CSS文本对齐容器的底部
发布评论