Reputation: 5144
Inside a div
with vertical-align: top;
I have two elements, an img
and a span
(with aaa inside).
Both elements have display: inline-block;
and width
and height
set.
No matter what I do and what I try, the elements are MISALIGNED as shown on picture below. What is wrong and how can I fix this?
This problem occurs in every browser - FF, IE, Safari ... http://jsfiddle.net/CaU59/
Upvotes: 5
Views: 4983
Reputation: 78630
You need to add vertical-align
to the elements themselves, not their container. They are currently aligned baseline
as you can see from the text lining up with the image.
Upvotes: 18
Reputation: 24703
vertical-align: top
is to be added to each element
DEMO http://jsfiddle.net/CaU59/1/
Upvotes: 11