Why does image use display: inline but behaves like an inline-block element

前端 未结 6 816
醉话见心
醉话见心 2021-01-06 01:02

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

Is there any difference between inline and inline-block for img elements, from what I can

6条回答
  •  灰色年华
    2021-01-06 01:13

    Inline block is the same as inline, except for it allows you to adjust block properties such as padding and margin. By default, images are supposed to semantically flow with text like a diagram in a news article, that is why all the original attributes are to do with aligning the image with the text flow.

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

提交回复
热议问题