background dimension as feasible as can be.
padding-bottom will be introduced to help archive this. What we do here is to populate the value of
padding-bottom calculated as percentage by the aspect ratio of background image, as well as the set the element’s
height is 0;
1) set the
height to 0;
2) calculate the image’s aspect ratio (the percentage of
height – (height/width) * 100 );
3) apply the image’s aspect ratio to the
padding-bottom for reveal the image height instead;
background-size to be 100% in order to keep the image the same size as the element.
background: url(image.jpg) no-repeat;