title: css absolute positioning with right alignment
body: <p>I have the following code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
       img
       {
           position:absolute;
           right:50px;
       }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
       &lt;h1&gt;This is a heading&lt;/h1&gt;
       &lt;img src="logocss.gif" width="95" height="84" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>from <a href="http://www.w3schools.com/cssref/tryit.asp?filename=trycss_position_right" rel="noreferrer">http://www.w3schools.com/cssref/tryit.asp?filename=trycss_position_right</a></p>
  
  <p>If I change the style of h1 to:
      h1
           {
               position:absolute;
               right:50px;
           }
  then both the h1 and img overlaps. </p>
  
  <p>Now I didn't mention the top position for img or h1. So in the first case when h1 didn't have any style, the img left h1 alone and occupy the next available space after the h1 and was aligned to the right side (50 px apart). But when I mentioned h1 to be 50px apart (with absolute positioning), both the img and h1 overlapped. Now as I didn't mention the top position then why is not img leaving h1 alone and follow it (instead of overlapping it)? I understand that we are using absolute positioning which leaves top position ambiguously specified so why is it automatically assuming that the img has to occupy the top:0 position? If h1 occupies top:0 position then it is fine because it is the first element. But img should respect the space of h1.</p>
  
  <p>Thanks in advance for help.</p>