HTML iframe

<iframe> tag

The iframe tag is used to display a web page within an another web page.

Syntax

Example

Try Yourself

Some websites are not allowed to display within the <iframe>, because of the server settings.

eg: https://google.com will not work.


width & height attribute in <iframe> tag

We can change the default iframe height and width.

Example

Try Yourself

Remove iframe border

When we create an iframe, the default border-width is set to 2px.

We can change or remove the iframe border using style attribute.

Example

Try Yourself

target attribute

This attribute is used to open the link given in the <a> tag and show it in iframe window.

iframe name value and <a> tag target name should be same.

Example

Try Yourself