title: Positioning a div to the right of its containing div
body: <p>I know this question will sound very basic but i just am not able to fix it.I have got a div container and im trying to position the a child div to the right.I tried positioning the container div with relative and then positioning the child div with absolute,but the parent div loses its width.<img src="https://i.stack.imgur.com/notxa.jpg" alt="enter image description here"></p>
  
  <p>please have a look at the image above,i need the div1 to position itself right of the divContainer. I have got other nested divs in divContainer, i need only div1 to be postioned on the right.</p>
  
  <pre><code>div#divContainer{
      margin-left:auto;
      margin-right:auto;
      top: 0px;
      width:1000px;
      background:#666;
      position:relative;
  
  }
  div#div1{
      height:45px;width:200px;
      background:yellow;
      position:absolute;
  
  }
  </code></pre>
  
  <p>HTML CODE</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
          &lt;title&gt;&lt;/title&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="divContainer"&gt;
              &lt;div id="div1"&gt;&lt;/div&gt; 
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>