Reputation: 7472
I'm trying to vertically align the text in the child
div to the bottom of the parent
div box.
Can anyone assist?
Thanks,
Upvotes: 1
Views: 2326
Reputation: 28124
You can also use:
.child {
display: table-cell;
vertical-align: middle;
}
I kind of prefer this one over complicated CSS hacks (Sarfraz - let's be honest, even if the dev looking at your code was born doing CSS would need to read it twice).
Of course, there are cross-browser implications. You decide whether you want to debug a two-liner or a jungle of CSS rules.
Upvotes: 2
Reputation: 43823
@Sarfraz got there first so my fix got saved as revision 4 http://jsfiddle.net/sUS8D/4/ (minus the float)
Upvotes: 1
Reputation: 382746
You need to adjust your CSS like this:
.parent {
float:left;
width:200px;
height:400px;
border: solid 1px;
position:relative;
}
.child {
vertical-align:bottom;
bottom:0;
position:absolute;
right:0;
}
Upvotes: 2