So, with the code below, when I change the border of the bar, the position of foo changes. But this only happens when the body is relatively positioned. If I statically position the body, then the position of foo no longer depends on the border of the bar. Can someone tell me what is going on?
<!DOCTYPE html> <html> <head> <style type="text/css"> * { margin:0; } body { position:relative; } #foo { position:absolute; top:50px; left:50px; } #bar { margin:100px; } </style> </head> <body> <div id="foo">asdf</div> <div id="bar">asdf</div> </body> </html>
source share