Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does an img push down the text content next to it?

Tags:

html

css

I have this bit of code:

<p><img src="img/icon.png" />View</p>

With the inclusion of that img tag, the text "view" is pushed down. Even if i try to give the p tag a line-height equal to the img height, it still looks off balance.

What am I missing? jsfiddle example: http://jsfiddle.net/bLUL6/

like image 773
JeffK Avatar asked Dec 31 '12 18:12

JeffK


1 Answers

img {
    vertical-align: bottom;
}
​

This blog has a detailed explanation of how vertical-align works with inline images.

like image 172
Barmar Avatar answered Nov 15 '22 03:11

Barmar