我需要嵌入一个框架内的HTML页面,现在用的是下面的代码:设置iframe的高度自动
<iframe src="http://www.google.com" style="width: 90%; height: 300px"
scrolling="no" marginwidth="0" marginheight="0" frameborder="0"
vspace="0" hspace="0">
我试图使高度设置为auto,使画面自动调整大小以页面长度不必硬编码高度,因为我在这里做。我试过height:auto
和height:inherit
但它没有工作。
你有没有尝试设置'高度:100%'如果iframe是在身体,应该使之补身体? – Xander 2013-03-06 19:15:54
** Duplicates:** [This](http://stackoverflow.com/questions/9975810/how-can-i-make-iframe-automatically-adjust-height-according-to-the-contents-with)或[this](http://stackoverflow.com/questions/819416/adjust-width-height-of-iframe-to-fit-with-content-in-it)都应该回答你的问题。 – anroesti 2013-03-06 19:16:24