<div> is a block level element
In any case, code found in books is often there merely as an
illustration and sometimes does not represent best practice.
a replaced inline element. However my point about sample code
in books still stands.
There are also many ways to skin a cat ...