Why doesn’t the relative-positioned div line up at 0,0 like the fixed-positioned div? I’ve tried setting padding/margin to 0, but it doesn’t seem to make any difference.
Why doesn’t the relative-positioned div line up at 0,0 like the fixed-positioned div? I’ve
Share
because the
divwithposition:relativetake as parent thebody. Thebodyhas automatically padding of 10 pixels (in firefox, in other browsers may differ) . If you addbody {padding:0;}will be both in the same place. To overcome “problems” like this, you can use a reset css like this http://meyerweb.com/eric/tools/css/reset/Example: http://jsfiddle.net/cWdWp/9/