Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

Changing the look of frames

Once you have decided where to put the frames on the screen, you also have some control over how the frames look. You can remove frame borders and change the border colour and width. You can also put margins around frames, remove scroll bars and stop users resizing frames.

The <frameset> tag has attributes to let you set the spacing between frames and specify whether the frames in the set have borders and, if so, what width and colour the border is.

The <frame> tag has attributes to let you:

  • Set the width and height of margins within the frame. Internet Explorer use the framespacing attribute in the <frameset> tag but Netscape uses the border attribute
  • Specify whether the frame has a border. Use the frameborder attribute. Set to YES for on and NO for off. Netscape only removes a border between frames if both the frames have the border turned off
  • Specify whether you want the browser to display the scroll bar. You use the scrolling attribute in the <frame> tag to do this. By default, Internet Explorer displays the scroll bar only if the entire content of the frame does not fit within the frame. If you never want a scroll bar to appear, set scrolling to NO. To always display the scroll bar (whether you need it or not), set scrolling to YES
  • Stop the user resizing a frame. Usually you can grab borders between frames and drag them to change their size. If you’ve gone to a lot of trouble to set up your frames and you don’t want the layout messed up, simply set the noresize attribute in the <frame> tag. If you do this for one frame in a frameset, you should probably do it for all of them