Home > Web Front-end > HTML Tutorial > Problems with div and iframe display_html/css_WEB-ITnose

Problems with div and iframe display_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:22:02
Original
946 people have browsed it

div iframe

The problem is this, I now have an iframe written in a div layer.
But there will be more and more content in this iframe, so the height will be higher and higher
The current situation is that if it is too high, not everything can be displayed in this layer
I originally I thought it would be enough to set the height of the div to auto and the height of the iframe to 100%
But I found that it didn’t work. What should I do?

Reply to discussion (solution)

div does not set height iframe height adaptive. http://download.csdn.net/detail/stongyann/4958175

Remove the style of the div and it will be full screen by default.

<div style="width:800px; height:600px;"><iframe style="display:none;" id="iframeInfo" name="iframeInfo" onload="javascript:{dyniframesize('iframeInfo');}" marginwidth="0" marginheight="0" height="100%" width="100%" scrolling="auto" frameborder="0" src="http://www.baidu.com"></iframe></div><script language="javascript">    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];    //extra height in px to add to iframe in FireFox 1.0+ browsers    var FFextraHeight=getFFVersion>=0.1? 16 : 0 ;  function dyniframesize(iframename) {	   var pTar = null;	   if (document.getElementById){		   pTar = document.getElementById(iframename);	   }	   else{		   eval('pTar = ' + iframename + ';');	   }	   if (pTar && !window.opera){		   //begin resizing iframe		   pTar.style.display="block";			  		   if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){			   //ns6 syntax			   pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;		   }		   else if (pTar.Document && pTar.Document.body.scrollHeight){			   //ie5+ syntax			   pTar.height = pTar.Document.body.scrollHeight;		   }	   }   }</script>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template