Skip to main content

Difference with div & span

div is block element, but span is inline element.

Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements. _w3.org

Block-level elements begin on new lines, inline elements do not.

參考資料 1: HTML elements