| |
The concepts of HTML Frames are the next step towards empowering the user to add style to the web page. HTML enables the designer to divide the space in the web page into several rectangular areas. Each of these rectangular areas is known as a frame and each frame represents a separate document. With the help of these frames, a part of the page can be kept stationary while the other parts can be scrolled or replaced.
In other words, Html frames define the display into multiple regions, some of which can be stationary and act as links to other pages; while others can be scrolled. The designer can arrange the data into several windows or windows according to his urgency and relevance.
Frame Tag
The <frame> tag sets a single frame in the framed page. The frame tag always goes inside a <frameset> tag. It has various attributes, including the SRC attribute that indicates the URL of the page that goes in the frame.
In the following example two frames are being made in one web page. The frame tag should be properly closed by putting a backslash (/) at the end of the tag. |
| |
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title”/> |
| <frame src=”body.html” name=”body”/> |
| </frameset> |
| |
| |
Attributes of Frame Tag
Src
Src indicates the URL to be put into the frame.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title”/> |
| <frame src=”body.html” name=”body”/> |
| </frameset> |
| |
| Note: Frames are not supported by the <body> element. The frames should be contained only within the <html> tag. |
Name
Name defines a unique name for the frames. It works like the name attribute in other tags.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title”/> |
| <frame src=”body.html” name=”body”/> |
| </frameset> |
| |
Scrolling
Scrolling means that there should be a scrollbar on the right and/or on the bottom of the screen. It has three values-yes, no and auto. Yes means there will be a scrollbar even when it is not needed. No means there will not be a scrollbar even when it is needed. Auto is the default value that means there will be scroll bars as and when needed.
Example: |
|
| <frameset rows=”20%,30%,*”> |
| <frame src= “title.html” name=”title” scrolling=yes/> |
| <frame src=”body.html” name=”body”/> |
<frame src=”body.html” name=”body” scrolling=no/>
<frame src=”data.html” name=”data” scrolling=auto/>
|
| </frameset> |
| |
Noresize
Noresize means that the user cannot make the frame bigger or smaller by sliding the borders. Normally the user can resize the border with a mouse. Noresize disables this ability.
Example: |
|
| <frameset rows=”20%,30%,*”> |
| <frame src= “title.html” name=”title” scrolling=yes noresize/> |
<frame src=”body.html” name=”body” scrolling=no/>
<frame src=”data.html” name=”data” scrolling=auto/>
|
| </frameset> |
| |
Frameborder
Frameborder sets the border around the frames. It takes up two values- yes and no. Yes sets the border to on and no sets the border to off. The default is yes.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title” frameborder=yes /> |
| <frame src=”body.html” name=”body” frameborder=no /> |
| </frameset> |
| |
Bordercolor
Bordercolor sets the color of the borders around the frame.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title” bordercolor=red/> |
| <frame src=”body.html” name=”body”/> |
| </frameset> |
| |
Marginwidth
Marginwidth sets the internal left and right margins of a frame.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title” marginwidth=2 /> |
| <frame src=”body.html” name=”body”/> |
| </frameset> |
| |
Marginheight
Marginheight sets the internal top and bottom margins of a frame.
Example: |
|
| <frameset rows=”20%,*”> |
| <frame src= “title.html” name=”title”/> |
| <frame src=”body.html” name=”body” marginheight=30/> |
| </frameset> |
| |
|