Si quiere que su código valide, puede hacerlo con javascript. He encontrado la respuesta perfecta cuando tuve este problema hace unos meses here
var iframe = document.createElement("iframe");
iframe.src = "banner_728x90.gif";
iframe.width = "728";
iframe.height = "90";
iframe.frameBorder = "0";
iframe.scrolling = "no";
document.body.appendChild(iframe);
f desea cargar otra página sin fisuras en el iframe se puede hacer esto si copia y pega este código en la cabecera de la página . Lo encontré en un sitio con scripts gratuitos. El rendimiento es bueno en la mayoría de los casos
function getDocHeight(doc) {
doc = doc || document;
var body = doc.body, html = doc.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
return height;
}
function setIframeHeight(id) {
var ifrm = document.getElementById(id);
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
ifrm.style.visibility = 'hidden';
ifrm.style.height = "10px"; // reset to minimal height in case going from longer to shorter doc
ifrm.style.height = getDocHeight(doc) + 10 + "px";
ifrm.style.visibility = 'visible';
}
Luego, le da a su iframe una identificación y llama al script cuando se carga. Así es como.
var iframe = document.createElement("iframe");
iframe.setAttribute('id', "ifrm1");
iframe.setAttribute('src', 'http://www.hekcmviw.com/'); // change the URL
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '10');
iframe.setAttribute('frameBorder', '0');
iframe.setAttribute('scrolling', 'no');
iframe.setAttribute('onload' ,"setIframeHeight(this.id)");
document.body.appendChild(iframe);
StackOverflow tiene una gran área de vista previa debajo del área de texto donde ingresa su pregunta. Use esa vista previa para corregir el formato la próxima vez antes de publicar. – OregonGhost