Finding the top of a moving div

Finding the top of a moving div

I have a code snippet that looks like this:

  1. <div id="a">
  2.   <div id="b">
  3.     <p>text in b</p>
  4.   </div>
  5.   <div id="c">
  6.     <p>text in c</p>
  7.   </div>
  8. </div>

When I issue

  1. a = $('#a')
  2. b = $('#b')
  3. a.css('top', '50px')
  4. b.css('top')

at the console, i expected to see "50px" or close to it.  Instead, "auto" appears.

Can anyone help me understand what I am doing wrong?