HTML and CSS

Margin, Resize, and Scroll Controls

You can control the behavior of your frame pages with a number of attributes. These include attributes to manage margins, frame resizing, and scrolling within frames:

  • The marginheight and marginwidth attributes allow a value in pixels to control the height and width of frame margins.

  • The noresize attribute fixes the frame into position so the user can't move the frame edges.

  • The scrolling attribute enables you to control the appearance of a scrollbar within a frame. This is important if you've fixed the size of your frame and the content within that frame is longer than the frame itself. There are three values for scrolling: yes (which forces a scrollbar at all times), no (which disallows a scrollbar completely), and auto (which automatically puts a scrollbar into the frame if it is necessary).

Example 6-8 shows a frameset document with margin, resize, and scroll controls in place.

Example 6-8. Managing margins, resizing, and scrolling in frames
<frameset cols="200, *">
<frame src="menu.html" marginheight="5" marginwidth="5" noresize="noresize" scrolling="yes" />
<frame src="main.html" marginheight="9" marginwidth="9"
noresize="noresize" scrolling="yes" />
</frameset>

Figure 6-6 shows the results.

Figure 6-6. Note forced scrollbars in each of the frames.