HTML Java

HTML JavaScript


HTML Iframes

  • An iframe is used to display a web page within a web page.
  • An HTML iframe is defined with the <iframe> tag.
  • Syntax:- <iframe src="URL"></iframe>

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


Iframe - Set Height and Width

  • Use the height and width attributes to specify the size of the iframe.
  • The height and width are specified in pixels by default.

Example

<html>
<body>
  <h2>HTML Iframes</h2>
  <iframe src="iframe.html" height="200" width="400"></iframe>
</body>
</html>
Try it »

Or CSS can be used to set the height and weidth of the iframe.



The <frameset> Tag Attributes

Following are the some of the important attributes of the <frameset> tag:

Sr. No. Attribute Description
1 cols Specifies how many columns are contained in the frameset and the size of each column.
2 rows This attribute works just like the cols attribute and takes the same values, but it is used to specify the rows in the frameset.
3 border This attribute specifies the width of the border of each frame in pixels.
4 frameborder This attribute specifies whether a three-dimensional border should be displayed between frames.
5 framespacing This attribute specifies the amount of space between frames in a frameset. This can take any integer value.


The <frame> Tag Attributes

Following are the some of the important attributes of the <frameset> tag:

Sr. No. Attribute Description
1 src This attribute is used to give the file name that should be loaded in the frame.
2 name This attribute allows you to give a name to a frame. It is used to indicate which frame a document should be loaded into.
3 frameborder This attribute specifies whether or not the borders of that frame are shown; it overrides the value given in the frameborder attribute on the <frameset> tag if one is given, and this can take values either 1 (yes) or 0 (no).
4 marginwidth This attribute allows you to specify the width of the space between the left and right of the frame's borders and the frame's content.
5 marginheight This attribute allows you to specify the height of the space between the top and bottom of the frame's borders and its contents. The value is given in pixels.
6 noresize By default, you can resize any frame by clicking and dragging on the borders of a frame. The noresize attribute prevents a user from being able to resize the frame.
7 scrolling This attribute controls the appearance of the scrollbars that appear on the frame.
8 longdesc This attribute allows you to provide a link to another page containing a long description of the contents of the frame.