Setting position of a new element with .offset gives me negative position

Setting position of a new element with .offset gives me negative position

I'm trying to learn jQuery, and I'm trying to create a set of absolutely-positioned elements across the page (why is a long story), positioning them with .offset.

However, an element positioned with .offset({ top:20, left:20 }) comes out as

  1. <div class="rand" style="top: -618px; left: -336px; ">20 - 20</div>
which is not at all what I expected...
  1. for (var i=0; i< n; i++) {
  2.       var off = {
  3.         top: i * 20 // Math.floor(h * Math.random())
  4.         ,left: i * 20 //Math.floor(w * Math.random())
  5.       };
  6.       divs.push($('<div />').
  7.                 appendTo($('body')).
  8.                 addClass('rand').
  9.                 offset(off).
  10.                 text(off.left + " - " + off.top).
  11.                 click(function(ev){
  12.                         var off = $(this).offset() ;
  13.                         alert("Pos: " + off.left + ", " + off.top) ;
  14.                       }
  15.                 ));
  16.     }
can anyone explain what I'm doing wrong?