Why does it matter where the closing div tags go here?


It’s not clear from your link exactly what you’re asking. Which div tags?

From the example posted, the DIV elements are nested just fine. For proper nesting, “first in, last out” is a decent thought model. Think of it also as a stack of bowls. Improper nesting results in something rather like wires crossing, not to mention visual confusion. Although most browsers are pretty forgiving of bad code, it’s certainly not something to rely on.


Couldn’t have said it any better! Aha.

Some other notes…
Proper nesting is important in understanding the DOM as well! It will definitely affect your CSS and DOM manipulation if you don’t properly close your divs.

Well if you want you can write that entire code one the same line but that would make it really hard to read.

Thank you very much!