WebDevelopersNotes logo

home-icon Home / HTML / HTML frame – Frames part 4

HTML frame – Frames part 4

HTML frame - Frames part 4

Important attributes of <FRAME>

  • SRC: This is a required attribute and takes the URL of a document to load in the frame.
  • BORDERCOLOR: Defines color for the border. Both, color names and hexadecimal color codes are accepted values.
  • FRAMEBORDER: Places a border. Values can be ‘1’ or ‘YES’ that display a border or ‘0’ or ‘NO’ which prevent border display.
  • MARGINWIDTH: Defines the amount of space in pixels between the left and right hand sides of the frame and its contents.
  • MARGINHEIGHT: Defines the amount of space in pixels between the top and bottom edges of the frame and its contents.
  • NAME: Specifies a name for the frame that can be used for easy reference. This is especially helpful when using scripting languages such as JavaScript or VBScipt. We shall see its use soon.
  • NORESIZE: Frames can be sized by the user if a border is present. By placing this attribute, you can prevent your visitors from resizing frames. This attribute takes no values.
  • SCROLLING: The attributes taken are ‘YES’, ‘NO’ or ‘AUTO’. A value of ‘YES’ will display a scroll bar eventhough one is not required. ‘NO’ will prevent any scroll bars and ‘AUTO’ lets the browser to decide if the frame needs a scroll bar.

The code below explores these attributes in more detail:

<HTML>
<HEAD><TITLE>My third framed page</TITLE>
</HEAD>
<FRAMESET COLS="20%, 80%" FRAMEBORDER="YES" BORDER="3">

   <FRAME SRC="menu.html" NOSIZE SCROLLING="YES"
   NAME="menuframe" MARGINWIDTH="0" MARGINHEIGHT="5">
   <FRAME SRC="main.html" NORESIZE SCROLLING="AUTO" 
   NAME="mainframe">

</FRAMESET>
<NOFRAMES>
There is no frame support on your browser.
</NOFRAMES>
</HTML>

We’ll name this file frames3.html. You can test it by click here.

Though a border is displayed between frames you will not be able to drag it and resize the frames. This is because of NORESIZE attribute. (You can resize frames in frames.html).
The two frames now have names, the left is called menuframe while the right mainframe.
We have specified ‘YES’ as the value for SCROLLING attribute of menuframe, so a scroll bar is displayed.
MARGINHEIGHT attribute in menuframe puts a 5 pixel space between the top and bottom edges and the contents. MARGINHEIGHT with 0 value causes the contents of menuframe to be placed sticking to the left edge.
SCROLLING for mainframe has been set to AUTO, which places the decision of putting scroll bars on the browser. In our case, these bars are not required, hence not displayed.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

If it's on the Internet, it must be true.

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

The world's first handheld commercially available mobile phone was Motorola's DynaTAC. It was priced at $3,995 upon release and had an LED display for dialling and recalling numbers. Martin Cooper of Motorola made the very first call from a cell phone using the DynaTAC on 3rd April 1973. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy