JSFiddle - React, Tailwind, and code Playground

HTML

This iframe should resize "itself" to 320x480 pixels.

CSS

html {
    background: #e0e0e0;
    border: 2px dashed #a0a0a0;
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    color: black;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
}

JavaScript

parent.postMessage(
    "iframely:style:width=320px&height=480px&overflow=hidden&border=0%20none%20transparent&background=transparent",
    "*");