iframe內嵌網頁/Youtube

張貼日期:2019/12/11 上午 02:13:44

<iframe>標記用來嵌入 HTML 網頁或Youtube影片。

width和height屬性是用來指定影片框的寬度和高度。  frameborder屬性是用來設定影片框是否有邊框(1:有框,0:無框)。

scrolling屬性用來設定是否顯示滾動條(可設定為 "yes"、"no" 及 "auto", 若設定為 "auto" 時

 當被嵌入的 網頁/Youtube, 超過框架的高度或寬度, 滾動條才會自動出現。)

****若要插入Youtube影片,請按Youtube影片下方的"分享" > "嵌入"> 複製 src 的連結

語法為:

<iframe src="被嵌入的 HTML 檔案路徑" width="mmm" height="nnn"   frameborder="w" scrolling="qqq"> </iframe>

網頁例子:

 <iframe src="http://www.tsvs.ntpc.edu.tw" width="480" height="360" frameborder="0" scrolling="yes"> </iframe>

Youtube例子:

 <iframe src="https://www.youtube.com/embed/3Y0Ut5ozaKs" width="480" height="360" frameborder="1" scrolling="yes"></iframe>