title: width and max-width attributes of image
body: <p>Could anyone tell me the relationship between <code>width</code> and <code>max-width</code> (such as which override which in terms of pixel, percentage, etc)?</p>
  
  <p>How can I use them if I want to:</p>
  
  <ul>
  <li><p>Auto scale an image when I resize the window and stop scaling when the image reach its original size?</p></li>
  <li><p>Keep a fixed size until I resize window to certain small size and then start to auto resize</p></li>
  </ul>