亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.430618.com 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

中顯示的頁面的HTML內容?”>

在本文中,我們需要在iframe中顯示頁面的HTML內容;瀏覽器窗口劃分為單獨的頁面。我們可以使用 標記及其 srcdoc 屬性來完成此任務。

HTML 標簽

HTML 中的 標記指定內聯框架。該內聯框架用于在當前 HTML 文檔中嵌入另一個文檔。所有瀏覽器都支持此標簽,例如 Google Chrome、Microsoft Edge/Internet Explorer、Firefox、safari 和 Opera 等。

標簽的“srcdoc”屬性用于指定要在頁面中顯示的HTML內容。該屬性將 HTML_code 作為值并指定要在 中顯示的頁面的 HTML 內容。

示例 1

在下面的示例中,我們使用帶有 標記的“srcdoc”屬性來指定要在 HTML 中的 中顯示的頁面(

元素)的 HTML 內容。

<!DOCTYPE html>
<html>
<head>
   <title>
      How to specify the HTML content of the page to show in the "iframe" in HTML?
   </title>
</head>
<body>
   <h3>How to specify the HTML content of the page to show in the "iframe" in HTML?</h3>
   <p>We can do it by using <b>srcdoc</b> attribute of iframe in HTML.</p>
   <iframe srcdoc="<h2>You can find any tutorial on tutorialspoint</h2>">
      <p>Browser does not support iframes.</p>
   </iframe>
</body>
</html>

登錄后復制

正如我們在輸出中看到的,文檔中的 HTML 內容(

元素)顯示在 中。

示例 2

以下是 HTML Iframe 的另一個示例,在此,我們在 iframe 中創建了一個表格。

<!DOCTYPE html>
<html>
<head>
   <title>
      How to specify the HTML content of the page to show in the "iframe" in HTML?
   </title>
</head>
<body>
   <h3>How to specify the HTML content of the page to show in the "iframe" in HTML?</h3>
   <p>We can do it by using <b>srcdoc</b> attribute of iframe in HTML.</p>
   <iframe srcdoc="<table border = 3>
         <caption> Abbreviations </caption>
         <tr>
            <th> HTML </th>
            <th> CSS </th>
         </tr>
         <tr>
            <td> Hypertext markup language</td>
            <td> Cascading style sheet </td>
         </tr>
      </table>">
      <p>Browser does not support iframes.</p>
   </iframe>
</body>
</html>

登錄后復制

正如我們在輸出中看到的,文檔中的 HTML 內容(HTML 表格)顯示在 中。

示例 3

默認情況下,所有瀏覽器都會將 顯示為默認值。我們可以使用CSS來改變的樣式。

在下面的示例中,

    我們通過使用 CSS 更改 的寬度、高度和邊框來更改其樣式。

    我們使用帶有 標記的“srcdoc”屬性來指定要在 HTML 中的 中顯示的頁面( 元素)的 HTML 內容。

    <!DOCTYPE html>
    <html>
    <head>
       <title>
          How to specify the HTML content of the page to show in the "iframe" in HTML?
       </title>
    </head>
    <body>
       <h3>How to specify the HTML content of the page to show in the "iframe" in HTML?</h3>
       <p>We can do it by using <b>srcdoc</b> attribute of iframe in HTML.</p>
       <iframe srcdoc="<div> Hello Disha</div>" width="50%" height="100" style="border:3px solid green;">
         <p>Browser does not support iframes.</p>
       </iframe>
    </body>
    </html>
    

    登錄后復制

    正如我們在輸出中看到的,文檔中的 HTML 內容( 元素)顯示在 中,并且我們還使用 CSS 更改了 的樣式。

    以上就是如何在HTML中指定要在<iframe>中顯示的頁面的HTML內容?的詳細內容,更多請關注www.92cms.cn其它相關文章!

分享到:
標簽:內容 指定 顯示 要在 頁面
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定