In HTML elements, the element will have the display attribute. The display attribute defaults to block, so the element is block-level. The display attribute defaults to inline, so the element is inline. The display default for no elements is inline-block. The display attribute value can be set, for example, to inline for the block-level div element, so it becomes an inline element and no longer displays independently.

  • Block, block
  • Inline: inline
  • Inline block level: inline-block
  1. Block-level elements have a single row. You can set width, height, padding, and margin. The interior can contain block-level and inline elements.
  2. Inline elements and other inline peers are displayed. You cannot set width, height, padding, or margin. The interior can contain block-level or inline elements. When the interior contains a block-level element, the block-level element continues to be displayed alone, and the next inline element is displayed on a newline.
  3. Inline block cascade and other inline lines are displayed. Width, height, margin, and padding can be set as block elements. The interior can contain block-level elements or inline elements. If the interior contains a block-level element, the block-level element will be displayed independently inside the inline element without affecting the display of the next inline element.