Search code examples
htmlcsscss-floatinlineblock

Is the text inside the <p> element considered an inline element?


I'm trying to make sense of the CSS float property, and I understand the basic motivation of text flowing around a floated image. My question is this: since inline elements flow around floated elements, even if if those inline elements are children of non-floated block-level elements, can we somehow consider the text inside the paragraph element to be inline? I'm trying to form a good mental model of what is happening. Thanks.


Solution

  • From the CSS spec:

    Any text that is directly contained inside a block container element (not inside an inline element) must be treated as an anonymous inline element.

    So it's an inline box generated by a block element as opposed to an inline box generated by an inline element. Anonymous only means that it doesn't have an associated inline element.