| Attributes of IFrame Tag
Scrolling
Scrolling indicates the need for scrollbars in the frame. It has three values- yes, no and auto. Yes means there will be a scrollbar even when it is not required. No means there will not be a scrollbar even when it is required. Auto is the default value, which means that there will be scroll bars as and when required.
Example: |
|
| <iframe src=”tables.html” width=450 height=100 name=”tables” scrolling=yes> |
</iframe> <iframe src=”hello.html” width=300 height=150
Name=”hello” scrolling=no > </iframe> |
| |
Align
Align offers an array of alignment options like in the image tag. However, for the <iframe> tag there are only three useful options. These are left, right and no align.
Left and right indicate that the frame should align to the left or right side of the page and the text should flow around it. When the no align attribute is used, then the frame is inline with the text.
Example: |
|
<iframe src=”tables.html” width=450 height=100
name=”tables” scrolling=yes align=left> |
| </iframe> |
<iframe src=”hello.html” width=300 height=150
Name=”hello” scrolling=no align=right> |
| </iframe> |
| |
Vspace and Hspace
Vspace sets the vertical distance between the text and the inline frame. Hspace sets the horizontal distance between the text and the inline frame. These attributes are most commonly used with the align attribute.
Example: |
|
<iframe src=”tables.html” width=450 height=100
name=”tables” hspace=5 vspace=5> |
| </iframe> |
| |
The following example illustrates a web page wherein frames are applied:
Frames Page
Example: |
|
<html> |
<head> |
<title>My frames page</title> |
</head> |
|
<frameset cols="30%,*" Border=10 bordercolor="#000055"> |
<frame src= "Mypages.html" name="lframe"/> |
<frame src="welcome.html" name="rframe"/> |
</frameset> |
|
</html> |
| |
Welcome Page
Example: |
|
<html> |
<head> |
<title> Welcome </title> |
<head> |
|
<body background ="myimage.jpg" text = “blue”> |
<h1> WELCOME!</H1> |
<H2> YOU CAN VIEW WEB PAGES HERE </H2> |
<H3> JUST CLICK ON A LINK ON THE LEFT SIDE OF THE PAGE </H3> |
</body> |
|
</html> |
| |
Links Page
|
<html> |
<head> |
<title> MY PAGES </title> |
</head> |
|
<body background ="myimage.jpg" text = “blue”> |
<a href="welcome.html" target="rframe"> WELCOME </a> <br/><br/> |
|
<h5> My Web Pages </h5> |
|
<a href="joke1.html" target="rframe"> Joke1 </a> <br/> |
<a href="joke2.html" target="rframe"> Joke2 </a> <br/> |
<a href="joke3.html" target="rframe"> Joke3 </a> <br/> |
<a href="joke4.html" target="rframe"> Joke4 </a> <br/> |
<a href="joke5.html" target="rframe"> Joke5 </a> <br/> |
<a href="joke6.html" target="rframe"> Joke6 </a> <br/> |
<a href="joke7.html" target="rframe"> Joke7 </a> <br/> |
<a href="joke8.html" target="rframe"> Joke8 </a> <br/> |
|
<br/> |
<a href="iframe.html" target="rframe"> Inline frames </a> <br/> |
|
</body> |
</html> |
| |
Iframe Page
| |
<html> |
<head> |
<title>My iframe page</title> |
</head> |
|
<iframe src="Mypages.html" width=300 height=200> |
</iframe> |
| |
This is how the web page looks:
Welcome Page:

The page displayed when joke8 is clicked is given below:

The page with inline frames looks like:

|