<!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>
<!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>
我们使用带有 标记的“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 更改了 的样式。