tutorialstonight logo
A Platform To Learn To Code

HTML IFRAME



HTML iframe also known as inline frame is used to display external objects or a webpage inside a web page.

Syntax of iframe

To define an inline frame we use HTML <iframe> tag.

Example


The src attribute is used to provide the address of a webpage or any external object.



Height and width of iframe

The height and width of an iframe can be specified using height and width attribute.

Example

Run the code

We can specify height and width either in percentage value or in pixel value.

OUTPUT:



iframe border removing

The frameborder attribute specifies border in iframe. It has two values 1 and 0. The default value is 1 which creates a border for removing borders. we can specify frameborder="0".

Example

Run the code

OUTPUT:


iframe as link target

An iframe can be used as target for any link

To use an iframe by any hyperlink it must have a target attribute specified to the name attribute of the iframe.

Example

Run the code

OUTPUT:

click here to open homepage in above iframe.