A block level element as defined by the W3Schools has having a line break before and after the element, such as p, h1, etc. Non nested inline elements either start on their own line (no line break) or remain on the same line if nested.
While span behaves normally (as well as all other inline elements). Div never creates line breaks like block elements all do, but only starts on a new line at the opening of the div element.
Perhaps I’m missing something since everyone talks about DIV being block level, but it behaves like an inline element in that it starts a new line if not nested, doesn’t create line breaks, but acts like something else entirely that when a div is nested with another div it just creates a new line.
Is DIV the only “hybrid” element like this? Am I missing something more fundamental?
No elements create line breaks. You’re merely seeing the effects of different default styles, which have different
marginandpaddingvalues. The default styles vary per browser, but often look something like the [very dated] reference stylesheet included with the HTML 4 spec: http://www.w3.org/TR/CSS2/sample.html