The Attributes of the HTML Frame Tag

Blank frame hanging on a wall

Tony Cordoza / Getty Images

When you create a framed page, the page that shows up in the URL has no real content (unless you have a <noframes> version). Instead, you create <frame> pages, which provide the information for your page.

Possible Attributes

  • src: This is the only required attribute for the frame tag. The value of this attribute is the URL of the document you would like to be displayed in the frame. You can reference any HTML object, image, or multimedia element that would normally be displayed by a web browser. (Keep in mind, if you use an image, it will not be tiled like a background image, but rather just displayed once.)
  • name: This allows you to label your frames so that you can open new pages in specific frames. If you do not name your frames, all links will open in the frame that they are in.
  • noresize: When you set the size of your frames, your readers can come in and change that size to suit them, unless you use the noresize attribute. This allows you to keep control of the layout of your page.
  • scrolling: This attribute dictates the behavior of a scrollbar on your frames. If the frame is larger than the browser window, a scrollbar will appear. If you never want the scrollbars to appear, put scrolling=no in your frame tag. The "yes" option dictates that there will always be a scrollbar on the frame, even if there is nowhere to scroll.
  • marginheight: This attribute defines how tall the margin between frames will be. It cannot be less than 1 pixel. Also, if the browser cannot display the desired values, then this attribute will be ignored.
  • marginwidth: This attribute defines how wide the margin between frames will be. It cannot be less than 1 pixel. Also, if the browser cannot display the desired values, then this attribute will be ignored.
  • frameborder: This attribute allows you to add or remove borders from a single frame on your page. Use the values "yes" or "1" to enable borders and "no" or "0" to disable borders. This attribute is handled differently in IE and Netscape, so if you want to use it, you should define the borders in all frames in your frameset so that you get a consistent view.

Noframes content

This tag allows readers without frames-enabled browsers to view your page. The most common use of this tag is to dictate what browser people should use; however, it's really easy to direct people to the first page of your frameset within the noframes tag. Just add in:

<noframes>
This document is framed, however, you can view the page at <a href="home.html">home.html</a>
</noframes>

If you're willing to spend a small amount of extra time, you can copy in the contents of your main page into the <noframes> portion of your frameset. This will result in very little loss of quality for your frameless readers.

Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "The Attributes of the HTML Frame Tag." ThoughtCo, Sep. 30, 2021, thoughtco.com/attributes-of-frame-tag-3464325. Kyrnin, Jennifer. (2021, September 30). The Attributes of the HTML Frame Tag. Retrieved from https://www.thoughtco.com/attributes-of-frame-tag-3464325 Kyrnin, Jennifer. "The Attributes of the HTML Frame Tag." ThoughtCo. https://www.thoughtco.com/attributes-of-frame-tag-3464325 (accessed March 28, 2024).