gpt4 book ai didi

html - 为什么图像使用显示: inline but behaves like an inline-block element

转载 作者:太空狗 更新时间:2023-10-29 15:26:22 26 4
gpt4 key购买 nike

为什么图片的默认显示样式是inline而不是inline-block?

img 元素的 inline 和 inline-block 之间是否有任何区别,据我所知,它们的行为方式完全相同。

最佳答案

IMG 是一个Inline & Replaced 元素。

A replaced element is any element whose appearance and dimensions are defined by an external resource.

根据 W3C

The IMG element has no content; it is usually replaced inline by the image designated by the src attribute, the exception being for left or right-aligned images that are "floated" out of line.

查看此链接了解更多 http://reference.sitepoint.com/css/replacedelements

关于html - 为什么图像使用显示: inline but behaves like an inline-block element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9928211/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com