I am trying to understand why is there a difference in how a browser displays
verses ?Here is an example: The expected
Mainly because is not valid HTML.
If you have a look through the different doctypes you'll notice that div cannot be self closing.
According to the W3C:
A div element must have both a start tag and an end tag.
Source: http://www.w3.org/TR/html-markup/div.html
To include Chucks comment here also, a trailing slash in HTML does not a self closing tag make. Self closing tags using a trailing slash are a feature of XHTML, not HTML.