Frames in Html is used to divide the browser into different sections where each section can load different Html documents. Collection of frame is known as Frameset.
Creating frames:We use frameset instead of body tag to divide web page into sections. Rows and Column attributes decide the Horizontal or Vertical Frames
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<html> <head> <title>HTML Frames</title> </head> <frameset rows = "50%,50%"> <frameset cols = "25%,50%,25%"> <frame name = "left" src = "/html/top_frame.htm" /> <frame name = "center" src = "/html/main_frame.htm" /> <frame name = "right" src = "/html/bottom_frame.htm" /> </frameset> <frameset rows = "10%,80%,10%"> <frame name = "top" src = "/html/top_frame.htm" /> <frame name = "main" src = "/html/main_frame.htm" /> <frame name = "bottom" src = "/html/bottom_frame.htm" /> </frameset> </frameset> </html> |
Output:
1 2 3 |
Frameset tag Attribute
- Cols
- Rows
- Border
- Frame Border
- Frame Spacing
HTML IFRAMES
It is similar to the frame tag but it is used to display “Webpage within the Webpage
Syntax:
1 2 3 |
<iframe src="URL"> ... </iframe> |
Attributes:
- Set Height Width: <iframe src=”URL” height=”200″ width=”300″></iframe>
- Set or Remove Border: <iframe src=”URL” style=”border:2px solid grey;”></iframe> //Set Border.
<iframe src=”URL” style=”border:none;”></iframe> //Remove Border. - Target: <iframe src=”URL” name=”frame_name”></iframe>