Why the image uses the: inline display, but behaves like an element of an inline block

Why is the default display style for an inline image instead of an inline block?

Is there a difference between the inline and inline block for img elements, from what I see that it behaves exactly the same.

+5
source share
6 answers

The default browser stylesheets were originally created using CSS1 for HTML3.2 , so the inline block was not available or needed. There is no difference between the two for picture elements.

References

+3
source

IMG - Inline .

- , .

W3C

IMG ; replaced inline, src, , "" .

http://reference.sitepoint.com/css/replacedelements

+6

, .

, Firefox, no-image img , width height CSS.

HTML-:

<img alt='no image' src='about:blank'><br>
<img alt='no image' src='about:blank'id=iblock>

CSS:

img {
    height: 100px;
    width: 100px;
    background: cyan;
}
#iblock {
    display: inline-block;
}

JsFiddle.

+3

box-model (, ), , .

+1

, , , , . , , , .

Inline-block is a new CSS2 declaration, and is not fully implemented in IE 6/7 .

+1
source

It is simply an inline element that supports dimension attributes: Inline content is an img element .

+1
source

All Articles