Reputation: 8885
Here is html:
<div style="height: 100px">
<span style="vertical-align:top;">top</span>
<span style="vertical-align:bottom;">bottom</span>
</div>
Why vertical-align
property does not work in this example? Do I use it incorrectly?
Upvotes: 0
Views: 117
Reputation:
I'm unsure what you want to achieve.
See this fiddle: http://jsfiddle.net/CaS5r/4/
It does work, but it only aligns to it's siblings.
span {
outline: 1px solid red;
}
div {
background: yellow;
height: 100px;
}
HTML
<div >
<span style="vertical-align:top;">top</span>
<span style="vertical-align:middle;">middle</span>
<span style="vertical-align:baseline;">baseline</span>
<span style="vertical-align:bottom;">bottom</span>
</div>
you can see it better if the font is bigger (e.g. 50px) http://jsfiddle.net/CaS5r/5/
You probably want to use display: table;
Then it does what you expect
Upvotes: 1