[英]How to change the size of this iframe?
我想將此iframe
嵌入到我的網頁中:
<iframe height="600px" width="600px" src="https://ionicabizau.github.io/github-profile-languages/api.html?damienAllonsius" frameborder="0"></iframe>
編輯
我得到了這個很酷的結果,但是不幸的是, iframe
太大了。
那我該如何重新縮放呢? 假設我要縮小50%。
當我將屬性height
和width
從600
更改為300
,我得到了這個結果
我該如何解決? 使用CSS類更改寬度和高度不會更改結果。 任何想法 ?
只需將CSS屬性transform
和transform-origin
應用於iframe
:
transform
將更改整個DOM object
樹的大小(還包括字體大小等) transform-origin
將指定調整大小應從top left
開始。 否則,它將從中心調整大小,並且調整大小的iframe
將在中間流動。
#frame { border: 1px solid black; transform: scale(0.5); transform-origin: top left; }
<iframe id="frame" src="http://google.at" frameborder="0"></iframe>
您可能需要一個div,然后嘗試將iframe
放入該div中。
將width:50%
應用於新創建的div。
.container-wrapper { width:50%; }
<!DOCTYPE html> <html> <body> <h2>HTML Iframes</h2> <p>You can use the height and width attributes to specify the size of the iframe:</p> <div class="container-wrapper"> <iframe src="https://ionicabizau.github.io/github-profile-languages/" height="100%" width="100%"> </iframe> </div> </body> </html>
您的iframe內容應具有足夠的響應速度才能顯示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.