Reputation: 974
How do I align two different-sized fonts next to each other so that the smaller text is centered vertically with the larger text?
HTML:
<div id="parent">
<span id="first">first</span>
<span id="second">second</span>
</div>
CSS:
#first {
font-size: 200%;
}
#second {
font-size: 100%;
}
JSFiddle: http://jsfiddle.net/BmbWr/
Upvotes: 1
Views: 5584
Reputation: 146191
This works fine
#first {
font-size: 200%;
}
#second {
font-size: 100%;
vertical-align:top;
line-height:38px;
}
Upvotes: 0
Reputation: 64847
Use line-height css property. Set both first and second with the same line height.
Upvotes: 0