JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<iframe id="myframe" src="http://www.cnn.com/"></iframe>
</div>
CSS
.container {
width: 100%;
height: 250px;
border: 3px solid blue;
}
.iframe-class {
width: 100%;
height: 100%;
border: 3px solid red;
overflow: auto;
}
JavaScript
$(function () {
setIFrameSize();
$(window).resize(function () {
setIFrameSize();
});
});
function setIFrameSize() {
var parentDivWidth = $("#myframe").parent().width();
var parentDivHeight = $("#myframe").parent().height();
$("#myframe")[0].setAttribute("width", parentDivWidth);
$("#myframe")[0].setAttribute("height", parentDivHeight);
}