Advanced HTML frames
- — 01 June, 2002 17:14
Following on from 'Introduction to HTML frames', we look at some frame properties that can change the look and functionality of your pages.
If you don't insert a border reference in the FRAMESET command, a default border will be inserted that is visible between the two display HTML pages. People usually don't want it to be obvious that they are using framed pages and remove the default border by inserting something similar to the following code:
<FRAMESET rows="87%,* " border="0">
There may be instances when a border of a given pixel value and colour is desired. This is done using a combination of both the border and bordercolor properties.
<FRAMESET rows="87%,* " border="5" bordercolor="black">
With frames, scrollbars may be visible (and adaptable) with each display HTML page that occurs on the screen. If not specified otherwise, scrollbars will automatically appear if the content of the HTML page is larger than the framed size allocated to it. This is the same as scripting scrolling="auto".
There are three values applicable with scrolling (insertable into the frame instances): SCROLLING="auto|yes|no".
<FRAME src="top.html" scrolling="yes">
As indicated, auto is the default property, yes will force scrollbars to show in both horizontal and vertical positions on that frame - even when they are not needed - and no will force them to never show, even if it means the entire content of the HTML page cannot be accessed.
If you are looking at a framed page, there is a chance you can change the size of the display for each HTML page by placing your mouse over the border, and dragging it out to a desired position. By default, all frames are resizable.
However, a lot of developers don't want viewers to be able to change the site design in this way. By inserting 'noresize' within the frame command, they force the borders to stay in the same positions - with resizing no longer possible by the user.
<FRAME src="bottom.html" NORESIZE>
This is used to display alternative content for the user when their browser does not support frames. FRAMESETs are ignored by non-capable browsers. Similarly, data between the NOFRAMES command is ignored by browsers that do support frames.
<FRAME src="top.html" >
<FRAME src="bottom.html" >
<NOFRAMES>Your browser doesn't support frames</NOFRAMES>
Sometimes, not all pages within a controller frame are to display row-wise or all in columns. To mix the rows and columns together, use a frameset command within an existing frameset. If the top left corner of your page were to be occupied by a document extending across the length of the browser, the first frameset would use rows; otherwise, columns.
Often when designing pages with frames, one of the display pages may also contain a navigational menu.
Using the displayed graphic as an example, imagine there is a menu in green.html. When you click on a link from here, you want it to open into the space occupied by orange.html. How do you make this happen?
1. First 'name' all individual frames into which you may want links to open
<FRAME src="orangepage.html" name="Orange">
2. In the document containing the link, use target to specify into which frame the link will go. This example opens the PC World home page in the frame that is presently taken by orangepage.html
<A href="http://www.pcworld.idg.com.au" target="Orange">PC World</a>
Additionally, there are two 'built-in' targets that the computer recognises. Here, I have described what would happen if you were to replace target="Orange" with each instance:
target="_blank" will open PC World in a new and separate browser window.
target="_top" will replace the entire framed page with the contents of PC World.