Javatpoint Logo
Javatpoint Logo

HTML iframes

HTML Iframe is used to display a nested webpage (a webpage within a webpage). The HTML <iframe> tag defines an inline frame.

Iframe Syntax

An HTML iframe is defined with the <iframe> tag:

Here, "src" attribute specifies the web address (URL) of the inline frame page.

Set Width and Height of iframe

You can set the width and height of iframe by using "width" and "height" attributes. By default, the attribute?s values are specified in pixels but you can also set them in percent. i.e. 50%, 60% etc.

Example: (Pixels)

Test it Now

Example: (Percentage)

Test it Now

You can also use CSS to set the height and width of the iframe.

Example:

Test it Now

Remove the border of iframe

By default, an iframe contains a border around it. You can remove the border by using <style> attribute and CSS border property.

Example:

Test it Now

You can also change the size, color, style of the iframe's border.

Example:

Test it Now

Iframe Target for a link

You can set a target frame for a link by using iframe. Your specified target attribute of the link must refer to the name attribute of the iframe.

Example:

Test it Now
Next TopicHTML JavaScript




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials