HTML frameborder Attribute

The obsolete HTML frameborder attribute was historically used to control whether a visible border appeared around a frame, most commonly with the <iframe> element and the obsolete <frame> element.

Historical Syntax

The frameborder attribute was commonly given a value of 0 or 1:

<iframe src="example.html" frameborder="0"></iframe>

A value of 0 requested that the frame border not be displayed, while a value of 1 requested that a border be displayed.

Historical Elements

The frameborder attribute was historically associated with framed content.

Element Historical Purpose
<iframe> Controlled whether a border was displayed around an inline frame.
<frame> Controlled whether a border was displayed around a frame in an obsolete frameset document.

Historical Use

The frameborder attribute provided a simple way to turn a frame border on or off directly in HTML. Authors commonly used frameborder="0" when they wanted framed content to appear without the browser's default frame border.

When borders were enabled, the browser determined much of their appearance. The attribute did not provide the detailed control over border width, style, and color that CSS provides.

The attribute was also used with the obsolete <frame> element in frameset-based layouts. Framesets and the <frame> element are no longer part of modern HTML authoring.

Why It Became Obsolete

The frameborder attribute controls presentation rather than the meaning or structure of the document. CSS became the standard method for controlling borders and other visual styling.

CSS also provides much greater control. Authors can independently specify a border's width, style, color, and individual sides instead of simply requesting that a frame border be shown or hidden.

Modern Alternative

Use CSS border properties instead of the obsolete frameborder attribute.

Historical HTML

<iframe src="example.html" frameborder="0"></iframe>

Modern HTML and CSS

<iframe class="example-frame"
        src="example.html"
        title="Example Content"></iframe>

<style>
.example-frame {
  border: 0;
}
</style>

The CSS border: 0; declaration removes the border from the <iframe>. If a visible border is wanted, CSS can define its width, style, and color:

.example-frame {
  border: 3px solid #0088cc;
}
Play in Editor

Learn More About CSS Borders

The CSS tutorials explain how to control borders and their individual characteristics:

  • CSS Borders - Learn how to add, remove, and customize element borders with CSS.

Legacy Browser Support

The frameborder attribute was widely recognized by older browsers for framed content, particularly when authors used frameborder="0" to suppress visible frame borders.

Modern browsers may continue to recognize legacy uses of the attribute for compatibility with older webpages, but new and updated pages should use CSS to control borders.

For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.

Other obsolete attributes historically associated with frames and their presentation include:

  • framespacing - Historically used to specify spacing between frames.
  • marginheight - Historically used to control vertical margins inside framed content.
  • marginwidth - Historically used to control horizontal margins inside framed content.
  • noresize - Historically used to prevent a frame from being resized.
  • scrolling - Historically used to control scrollbars for framed content.

Specifications

The frameborder attribute is obsolete and borders around modern <iframe> elements should be controlled with CSS. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.