<img src="https://via.placeholder.com/3/4" style="
                                                  --image-width: 800px;
                                                  " alt="">
img{
  width: var(--image-width);
  height: calc(var(--image-width)*3/4);
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.