If you’re on a free Medium plan, click here to read — Free Access
For more questions and answers visit our website at Frontend Interview Questions
What is an <iframe>
?
An <iframe>
(Inline Frame) is an HTML element that embeds another HTML document within the current document. It allows you to load external content, such as a website or an application, into a section of your page.
Basic Syntax:
<iframe src="URL" width="width" height="height" frameborder="border" allowfullscreen></iframe>
src
: The URL of the page to display.width
andheight
: Dimensions of the iframe.frameborder
: Defines whether the iframe should have a border (deprecated in HTML5, use CSS instead).allowfullscreen
: Allows the iframe content to be displayed in full-screen mode.
Using <iframe>
in Angular
To use <iframe>
within an Angular application, follow these steps:
- Add
<iframe>
to a Component Template - You can include the
<iframe>
element directly in your component's HTML template. Ensure you provide a validsrc
URL and specify dimensions as needed.