我需要嵌入一個框架內的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