[HTML]如何設定iframe內容的顯示比例

有關網頁及相關語法的討論
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

[HTML]如何設定iframe內容的顯示比例

文章 tim »

一般在 iframe 進來的網頁內容, 有時希望顯示的比例做些調整, 以符合原網頁及 iframe 進來的網頁的顯示比例, 這時候可以利用 iframe 的 css 屬性來調整顯示比例, 操作方式如下:

inline方式:

代碼: 選擇全部

<iframe id="myiframe" style="zoom: 0.8; -moz-transform: scale(0.8); -moz-transform-origin: 0 0;" width=320 height=240 src="http://bbs.diary.tw/aa.htm"></iframe>
或是css方式:

代碼: 選擇全部

<style>
#myiframe { zoom: 0.8; -moz-transform: scale(0.8); -moz-transform-origin: 0 0; }
</style>
....
<iframe id="myiframe" width=320 height=240 src="http://bbs.diary.tw/aa.htm"></iframe>
其中的 zoom: 0.8 是 for ie8 使用的 css 的 extension, 而 -moz 的就是 for firefox 使用的.

參考資料:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://stackoverflow.com/questions/1661 ... -of-iframe
多多留言, 整理文章, 把經驗累積下來.....
回覆文章