Used to embed another HTML document or web page within the current document.
They provide a way to display content from another source on your webpage without having to navigate away from the main page.
This is commonly used to include external content such as videos, maps, advertisements, or other web pages within your site.
To use an iframe, you need to specify the URL of the content you want to embed and optionally provide attributes for customization.
Syntax: <iframe src="https://www.example.com/" ></iframe>
<!DOCTYPE html>
<html>
<head>
<title>HTML Iframe Example</title>
</head>
<body>
<iframe src="URL" width="width" height="height" frameborder="border" scrolling="scrolling"></iframe>
</body>
</html>
Here are the attributes used in iframe element.
Table Attribute
Description
Example
sandbox
A security attribute that restricts the capabilities of the iframe's content, providing an extra layer of protection
title
Provides a title for the iframe, which is displayed as a tooltip when the user hovers over it
referrerpolicy
Controls the HTTP referer header value when navigating to the content of the iframe
You can remove the border for an iframe using style attribute with "border:none"
or by setting the framebrder attrbute value to 0
<!DOCTYPE html>
<html>
<head>
<title>Border Iframe Example</title>
</head>
<body>
<iframe src="https://online-tools.bmreducation.com/" frameborder="0"></iframe>
<iframe src="https://online-tools.bmreducation.com/" style="border: none;"></iframe>
<iframe src="https://online-tools.bmreducation.com/" style="border: 2px solid black;"></iframe>
</body>
</html>
The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compile or Try on own Now