HTML Tutorial – Iframe

An IFrame (Inline Frame) is an HTML document embedded inside another HTML document on a website. In another word, an iframe is used to display a web page within a web page.

Iframe Syntax

Syntax for Iframe is very easy, just define it with the <iframe>.

<iframe src="URL"></iframe>

The src attribute specifies the URL (web address) of the inline frame page.

Iframe – Height and Width

height and width attributes define the size of the Iframe.

Iframe Set Height and Width Example

<!DOCTYPE html>
<html>
<body>
<iframe src="https://whatabouthtml.com/" height="500" width="500"></iframe>
</body>
</html>
Try it yourself »

Iframe – Remove Border

Iframe has a border around it by default. To remove the border, use the use the CSS border property.

Iframe Remove Border Example

<!DOCTYPE html>
<html>
<body>
<iframe src="https://whatabouthtml.com/" style="border:none;" height="500" width="500"></iframe>
</body>
</html>
Try it yourself »

Iframe – Border Size and Color

You can change the size and color of an Iframe’s border using CSS border property.

Iframe Change Border Size and Color Example

<!DOCTYPE html>
<html>
<body>
<iframe src="https://whatabouthtml.com/" style="border:3px solid black;" height="500" width="500"></iframe>
</body>
</html>
Try it yourself »