This can actually be done with only CSS, but the content inside the div must be absolutely positioned. The key is to use padding as a percentage and the box-sizing: border-box
CSS attribute:
div {_x000D_
border: 1px solid red;_x000D_
width: 40%;_x000D_
padding: 40%;_x000D_
box-sizing: border-box;_x000D_
position: relative;_x000D_
}_x000D_
p {_x000D_
position: absolute;_x000D_
top: 0;_x000D_
left: 0;_x000D_
}
_x000D_
<div>_x000D_
<p>Some unnecessary content.</p>_x000D_
</div>
_x000D_
Adjust percentages to your liking. Here is a JSFiddle