日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

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

中顯示的頁面的HTML內(nèi)容?”>

在本文中,我們需要在iframe中顯示頁面的HTML內(nèi)容;瀏覽器窗口劃分為單獨(dú)的頁面。我們可以使用 標(biāo)記及其 srcdoc 屬性來完成此任務(wù)。

HTML 標(biāo)簽

HTML 中的 標(biāo)記指定內(nèi)聯(lián)框架。該內(nèi)聯(lián)框架用于在當(dāng)前 HTML 文檔中嵌入另一個(gè)文檔。所有瀏覽器都支持此標(biāo)簽,例如 Google Chrome、Microsoft Edge/Internet Explorer、Firefox、safari 和 Opera 等。

標(biāo)簽的“srcdoc”屬性用于指定要在頁面中顯示的HTML內(nèi)容。該屬性將 HTML_code 作為值并指定要在 中顯示的頁面的 HTML 內(nèi)容。

示例 1

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

元素)的 HTML 內(nèi)容。

<!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>

登錄后復(fù)制

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

元素)顯示在 中。

示例 2

以下是 HTML Iframe 的另一個(gè)示例,在此,我們在 iframe 中創(chuàng)建了一個(gè)表格。

<!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>

登錄后復(fù)制

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

示例 3

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

在下面的示例中,

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

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

    <!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>
    

    登錄后復(fù)制

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

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

分享到:
標(biāo)簽:內(nèi)容 指定 顯示 要在 頁面
用戶無頭像

網(wǎng)友整理

注冊時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

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

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定