How to specify in HTML the HTML content of a page to be displayed in an
WBOY
Release: 2023-09-10 14:57:07
forward
1309 people have browsed it
In this article, we need to display the HTML content of the page in an iframe; the browser window is divided into separate pages. We can accomplish this using the
HTML
The
HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. This tag is supported by all browsers such as Google Chrome, Microsoft Edge/Internet Explorer, Firefox, Safari, Opera, etc.
The "
srcdoc" attribute of the tag is used to specify the HTML content
Example 1
In the following example, we use the "srcdoc" attribute with the tag to specify the HTML content of the page ( element) to be displayed in
of the HTML.
How to specify the HTML content of the page to show in the "iframe" in HTML?
How to specify the HTML content of the page to show in the "iframe" in HTML?
We can do it by using srcdoc attribute of iframe in HTML.
Browser does not support iframes.
Copy after login
As we can see in the output, the HTML content (
elements) in the document is displayed in .
Example 2
Here is another example of HTML Iframe, here we create a table inside the iframe.
How to specify the HTML content of the page to show in the "iframe" in HTML?
How to specify the HTML content of the page to show in the "iframe" in HTML?
We can do it by using srcdoc attribute of iframe in HTML.
Browser does not support iframes.
Copy after login
As we can see in the output, the HTML content (HTML table) in the document is displayed in .
Example 3
By default, all browsers will display as the default. We can use CSS to change the style of .
In the example below,
We change the style of by changing its width, height, and borders using CSS.
We use the "srcdoc" attribute with the tag to specify the HTML content of the page (element) to be displayed in in the HTML.
How to specify the HTML content of the page to show in the "iframe" in HTML?
How to specify the HTML content of the page to show in the "iframe" in HTML?
We can do it by using srcdoc attribute of iframe in HTML.
Browser does not support iframes.
Copy after login
As we can see in the output, the HTML content ( element) in the document is displayed in , and we also changed the style of using CSS.
The above is the detailed content of How to specify in HTML the HTML content of a page to be displayed in an ?. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn