<img> positioning behavior

It seems that I am not inclined to how img tags behave next to the text on the html page.

I removed the fields and additions, but there is always some extra space under img or some other unexpected behavior. I'm sure the quick CSS CSS method is based on using absolute positioning or negative margins, but I'm looking for a more general solution.

Question: Can someone explain how the img tags are located, in particular, why they shift vertically when next to the text?

+5
source share
7 answers

, <img> , vertical-align CSS, , , . "vertical-align on online elements".

+1

CSS display:: block inline.

Inline . , , - .

( , ).

, <img> - <a>, <abbr> . , , , , , , 12pt , 130px . .

<img style="display:block;" src="image.png" />, , .

+1

, , float :

img {
float:left;
display:block;
}
+1

, img, - , , g j. , .

img
{
    display: block;
}

.

, :

<p style="font-size: 1em;">Lorem ipsum dolor <em style="font-size: 800%;">sit</em> amet.</p>

<em> 128 ( 1em - 16 ).

0

IMG , .

0

, DIV DIV. div, .

0

(, ), , , , , .., (, , , ..

, ..,

body { margin: 0; padding: 0; border: 0; }

CSS, .., , - , , .

0

All Articles