the code isn’t some random messed up code, i found it in a book:
<div id="main">
<div><img src="images/img1.png" /></div>
<div><img src="images/img2.png" /></div>
<div><img src="images/img3.png" /></div>
<div><img src="images/img4.png" /></div>
</div>
so..why is he putting every img tag inside div tag?
for styling maybe? he can use img tag to style them, or even main ID
Maybe because
<div>is a block level element and<img>is not?In any case, code found in books is often there merely as an illustration and sometimes does not represent best practice.
<img>is actually a replaced inline element. However my point about sample code in books still stands.There are also many ways to skin a cat …