Reputation: 17
I've read some articles on the internet stating that if an element is one of the following display types: inline
, inline-block
, or table-cell
, then vertical-align
should work. I created this Fiddle to check it out, but this doesn't seem true.
What are the ULTIMATE requirements that when followed, vertical-align
always works?
Here is my Fiddle.
Upvotes: 1
Views: 71
Reputation: 8268
Use display: table-cell
and vertical-align: bottom
on the outer div:
.a1{
height: 300px;
background: #ccc;
display: table-cell;
vertical-align: bottom;
}
.a2 {
height: 20px;
background-color: #f00;
}
Upvotes: 1