Why is the display property of floated elements said to be block level?

旧时模样 提交于 2020-02-25 22:07:42

问题


Why do we say that the display property of floated elements may change to block level, instead of saying inline-block, because it starts taking the space according to the content it wraps?


回答1:


inline-block means inline level, block container.

inline-level elements participate in the layout of a line (or multiple lines). This affects line spacing and the vertical alignment of other elements in the same line.

Floated elements do none of that. The participate in block formatting contexts, not inline formatting contexts.




回答2:


That is the purpose of float. found some information in here

The float CSS property specifies that an element should be placed along the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the web page, though still remaining a part of the flow (in contrast to absolute positioning).

Also

when an element is floated, it is taken out of the normal flow of the document (though still remaining part of it). It is shifted to the left, or right, until it touches the edge of its containing box, or another floated element.



来源:https://stackoverflow.com/questions/52923504/why-is-the-display-property-of-floated-elements-said-to-be-block-level

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!