Where does the space of relative division come from?

advertisements

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.

http://jsfiddle.net/helpermethod/cWdWp/4/


because the div with position:relative take as parent the body. The body has automatically padding of 10 pixels (in firefox, in other browsers may differ) . If you add body {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/