I want to get the following for an element <img>in HTML using only CSS :
width: calc(100% - 20px)
height: calc(width * 0.5625)
There are examples on the Internet for links to elements <div>and their background. But in the case of elements, <img>indentation does not work
Similair example: Maintain aspect ratio of div with CSS
Edit using jQuery you can achieve above:
$(".myImage/s").outerHeight($(".myImage/s").outerWidth() * 0.5625);
source
share