[CSS] Responsive Center Align Image


CSS rule for HTML img element to be both responsive and centered horizontally.

CSS:

img.responsive-image-align-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    height: auto;
}

Demo:

To know how to make image responsive, see [1].
To know how to make image centered, see [2].

Tested on: Chromium Version 57.0.2987.98 Built on Ubuntu , running on Ubuntu 17.04 (64-bit)