title: How to keep absolutely positioned element in place when browser window resized
body: <p>I have absolutely positioned text so that it sits inside of my header image, but I cannot figure out how to keep it from moving outside of the header when the browser gets re-sized. If the browser window gets re-sized to a smaller size, the text moves outside of the header, but if the browser window gets re-sized to a bigger size, the text keeps moving to the right of the header!</p>
  
  <p>The header is 800px wide and 150px tall, and it's positioned in the middle of the browser window.</p>
  
  <p>Here's my HTML code:</p>
  
  <pre><code>&lt;div id="container"&gt;
      &lt;div id="header"&gt;
          &lt;img src="images/header.jpg" alt="Site Header Image"&gt;
          &lt;h1&gt;Our Site&lt;/h1&gt;
          &lt;h2&gt;Catchy slogan...&lt;/h2&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's my CSS code:</p>
  
  <pre class="lang-css prettyprint-override"><code>body {
      margin: 0px;
      padding: 0px;
  }
  
  #header h1 {
      color: #FFFFFF;
      position: absolute;
      top: 0px;
      left: 305px;
  }
  
  #header h2 {
      color: #FFFFFF;
      position: absolute;
      top: 30px;
      left: 330px;
  }
  
  #header img {
      width: 800px;
      height: 150px;
      display: block;
      margin-left: auto;
      margin-right: auto;
  }
  </code></pre>