HTML frameborder Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The frameborder attribute shows or hides the border around an <iframe> (and historically a <frame>). Value 1 draws a border (default); value 0 removes it.

It is presentational. For new pages, control the look with CSS border — for example border: none instead of frameborder="0".

Deprecated.

Do not use frameborder in new pages. Prefer CSS. Browsers still honor it on many iframes for old content.

Not the table frame attribute.

frame on <table> picks which outer table sides are drawn. frameborder only toggles an iframe/frame border.

HTML Syntax

syntax.html
<iframe frameborder=" 0 | 1">

Always give the iframe a meaningful title for accessibility.

Attribute Values

Two numeric values:

ValueDescriptionTry it
1Draw a border around the frame (default)Try it
0No border. Prefer CSS border: noneTry it
CSS replacementborder: none or a custom border styleTry it

Live Preview

Toggle frameborder on a demo iframe. Prefer CSS in real projects.

Legacy demo. New pages should use CSS border instead.

iframe

frameborder="1" — border drawn

HTML Examples

Legacy snippets for study, plus a CSS replacement. Use Try It Yourself for a live editor.

Example 1 — frameborder="1" (Legacy)

Default behavior: a visible border around the iframe.

HTML
<iframe
  src="/html"
  title="HTML section"
  width="320"
  height="120"
  frameborder="1">
</iframe>
Try It Yourself

How It Works

  1. frameborder="1" requests a border around the frame.
  2. Default is also 1 if the attribute is omitted.
  3. title names the embed for assistive technology.
  4. Prefer CSS if you want a custom border style or color.

Example 2 — frameborder="0" (Legacy)

Common old pattern for a “borderless” embed.

HTML
<iframe
  src="/html"
  title="HTML section"
  width="320"
  height="120"
  frameborder="0">
</iframe>
Try It Yourself

How It Works

  1. frameborder="0" asks the browser not to draw a frame border.
  2. Still an iframe — only the border chrome changes.
  3. Some UAs may still show a faint outline; CSS is more reliable.
  4. Replace with border: none in modern CSS.

Example 3 — Modern CSS Replacement

Same borderless look without the deprecated attribute.

HTML
<style>
  iframe.embed {
    border: none;
    width: 100%;
    max-width: 320px;
    height: 120px;
  }
</style>

<iframe
  class="embed"
  src="/html"
  title="HTML section">
</iframe>
Try It Yourself

How It Works

  1. No frameborder in the markup.
  2. border: none removes the border via CSS.
  3. Easy to restyle — color, radius, or shadow without HTML changes.
  4. Keep title for accessible naming of the embed.

Edge Cases & Pitfalls

Most issues are deprecated usage or mixing up similar attribute names.

deprecated

Do not use in new UI

Presentational attributes are superseded by CSS. Keep frameborder only when reading or patching old pages.

vs

Not table frame

frame on tables controls outer border sides. Different attribute, different element.

css

CSS wins for consistency

User-agent default iframe borders vary slightly. Explicit border styles are more predictable across browsers.

a11y

Always set title

Border or not, an iframe needs an accessible name via title.

script

IDL name is frameBorder

In JavaScript the property is camelCase frameBorder. Prefer CSS classes over toggling the attribute.

Browser Support

frameborder is a deprecated HTML attribute for iframes (and legacy frames) in the browser. It is not a Node.js, Deno, or Bun API.

✓ Deprecated · Still widely parsed

frameborder

Still recognized in major browsers for legacy iframes, but marked deprecated. Prefer CSS border for new work.

97% Legacy recognition (approx.)
Google Chrome Supported (legacy)
Supported
Mozilla Firefox Supported (legacy)
Supported
Apple Safari Supported (legacy)
Supported
Microsoft Edge Supported (legacy)
Supported
Opera Supported (legacy)
Supported
Samsung Internet Modern
Supported
Internet Explorer Yes
Supported
frameborder Supported · deprecated

Bottom line: Fine for understanding old embeds. Do not rely on frameborder for new designs — use CSS border.

Key Takeaways

  • Role: 1 shows an iframe border; 0 hides it.
  • Elements: <iframe> (and legacy <frame>).
  • Status: deprecated — use CSS border instead.
  • a11y: always set a meaningful title on iframes.

One line: frameborder toggled iframe borders — replace 0/1 with CSS border today.

Frequently Asked Questions

On an iframe (and historically on frame), frameborder="1" draws a border around the frame and frameborder="0" removes it. The default is 1.
Yes. MDN lists it among deprecated iframe attributes. Prefer the CSS border property to show or hide the border.
Use CSS such as iframe { border: none; } or border: 0.
Primarily iframe. Legacy frameset documents also used it on frame elements.
No. Table frame chooses which outer table sides are drawn. frameborder toggles an iframe/frame border on or off.
No. Learn it for older markup. Style iframes with CSS borders instead.

Next: headers

Associate table cells with header cells using the headers attribute.

headers tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful