Task is as simple as it gets, yet I can't seem to grasp it. I put together a basic HTML Snippet. Check out my Code Pen
In the pen, there are 3 nested divs, with div1
serving as the main div for my React Application. The background color of the body is set to pink
. I included a div => header
and another div => logo
. Now the header div has a background color of green
. So far so good. Within my logo div, I placed an img
tag. Not satisfied with the image's position, I added a margin-top
to my logo div. My goal was for the logo div to have margin from the top of the header div in green. However, instead of that, a margin appeared between the body top and the header div.
https://i.sstatic.net/GT2zh.png
I am puzzled as to why this is happening. Any suggestions?