<div>
	<img src="https://picsum.photos/500/250" alt="">
</div>
div{
	padding-top: 50%;
	position: relative;
	img{
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
	}
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.