Reputation: 391
I want "text 2" to be aligned vertically center to a text before it (i.e. "text 1" here).
<span style='font-size:22px'>text 1</span><span class='two'>text 2</span>
.two{
color:red;
font-size: 12px;
}
I thought vertical-align:middle
for the .two
class but it doesn't seem to work..
Here is the fiddle
Upvotes: 1
Views: 76
Reputation: 6309
You might need to apply vertical-align
to both <span>
.
span { vertical-align: middle }
Upvotes: 2
Reputation: 56
Create a container for your text content, a span perhaps, and do the following:
span {
display:inline-block;
vertical-align:middle;
}
Upvotes: 3