.outer { position: relative; &:before { display: block; content: ""; width: 100%; padding-top: (9 / 16) * 100%; } > .inner { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter