keep aspect ratio of image css

CSS
img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}
Source

Also in CSS: