如何在HTML中包含內聯子視窗?


內聯子視窗是一個 iframe,您可以使用 <iframe> 標籤來包含它。

HTML <iframe> 標籤支援以下附加屬性:

屬性

描述
align
left
right
top
middle
bottom
指定如何根據周圍文字對齊 iframe。
frameborder
1
0
指定是否顯示框架周圍的邊框。
height
畫素
指定內聯框架的高度。
longdesc
URL
指向框架內容的詳細描述的 URL
marginheight
畫素
允許您指定框架邊框和框架內容左右之間的空間寬度。值為畫素。例如 marginwidth = "10"。
marginwidth
畫素
指定框架內容與其左右邊距之間的邊距(以畫素為單位)。
name
文字
框架名稱
sandbox
"" allow-forms
allow-same-origin
allow-scripts
allow-top-navigation
為 iframe 中的內容啟用一組額外的限制。
scrolling
yes
no
 auto
確定捲軸操作
seamless
seamless
指定 iframe 應看起來像是包含文件的一部分
src
URL
框架內容檔案的位置
srcdoc
HTML程式碼
指定要在 iframe 中顯示的頁面的 HTML 內容
width
畫素
指定內聯框架的寬度。

示例

您可以嘗試執行以下程式碼來建立內聯框架:

<!DOCTYPE html>
<html>
   <head>
      <title>HTML iframe Tag</title>
   </head>
   <body>
      <iframe src = "https://tutorialspoint.tw/index.htm" width = "100%"></iframe>
   </body>
</html>

更新於:2020年5月29日

378 次瀏覽

啟動您的 職業生涯

完成課程獲得認證

開始學習
廣告
© . All rights reserved.