Contain an image within parent element

If you want to size an image proportionally to completely contained in its parent element just use max-width and max-height properties.

/*your image selector*/
img
{
   max-width : 100%;
  max-height : 100%;
}