Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS vertical align different text size

Assuming the following HTML:

​<p><span style="font-size: 40px;">A</span>a​​​​​​​​​​​​​​​​​​​​​​</p>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Is it possible to get the second character to align to the center of the first?

Actual Result

The second character is aligned to the bottom of the first character in this example:

enter image description here

Expected Result

However, I want the second character to be aligned to the middle of the first character:

enter image description here

like image 777
jacktheripper Avatar asked May 31 '12 18:05

jacktheripper


2 Answers

Just add in the vertical-align:middle; style.

http://jsfiddle.net/uEu6B/1/

like image 52
Nick Rolando Avatar answered Oct 24 '22 12:10

Nick Rolando


Add vertical-align:middle; to the <span> (example):

<p><span style="font-size: 40px;vertical-align: middle;">A</span>a</p>​​​​​​​​​​​​
like image 43
Orbiting Eden Avatar answered Oct 24 '22 14:10

Orbiting Eden