👀 Live Preview
Compare bordered vs borderless iframe styling (simulated):

The frameborder attribute controls whether a visible border is drawn around <iframe> elements and legacy <frame> elements. Use frameborder="0" for a seamless embed or frameborder="1" to show a border. In modern HTML, CSS is often preferred over this attribute.
Values 0 and 1.
Most common today.
Frameset era.
border: none;
JS property name.
Still supported.
frameborder AttributeThe frameborder attribute determines whether a visible border should be drawn around embedded frames. It is typically applied to <iframe> elements when embedding external content, or to legacy <frame> elements inside obsolete <frameset> layouts.
Frames are deprecated for page layout, but frameborder remains useful for understanding older web pages and for quickly toggling iframe borders in simple examples.
In HTML5, frameborder on <iframe> is obsolete. Prefer style="border: none;" or iframe { border: none; } in CSS for borderless embeds.
Add frameborder to an <iframe> with 0 or 1:
<!-- Border visible -->
<iframe src="example.html" frameborder="1"></iframe>
<!-- No border (common for embeds) -->
<iframe src="example.html" frameborder="0"></iframe><iframe> and legacy <frame> elements."0" (no border) or "1" (border shown).border gives finer control over width, color, and style.The frameborder attribute accepts two main values:
1 — A border is drawn around the frame. This was the historical default in many browsers.0 — No border is drawn. Common for embedded maps, videos, and widgets that should blend into the page.<iframe src="/map" frameborder="0" width="600" height="400"></iframe>| Value | Effect | Typical Use |
|---|---|---|
0 | No border | Embedded widgets, seamless embeds |
1 | Border visible | Legacy demos, visible separation |
| CSS equivalent | border: none; | Modern recommended approach |
| Element | <iframe>, <frame> | Embedded browsing contexts |
| JS property | iframe.frameBorder | String "0" or "1" |
| HTML5 status | Obsolete on iframe | Still works in browsers |
| Element | Supported? | Notes |
|---|---|---|
<iframe> | Yes | Primary modern use; attribute obsolete but supported |
<frame> | Yes (legacy) | Inside obsolete framesets |
<img>, <div> | No | Use CSS border instead |
frameborder vs CSS border| Approach | Example | When to Use |
|---|---|---|
frameborder="0" | <iframe frameborder="0"> | Quick legacy/simple embeds |
| CSS border | iframe { border: none; } | Modern projects (recommended) |
| Inline style | style="border:0" | One-off borderless iframe |
iframe with border, borderless embed, legacy frameset frames, and dynamic frameBorder with JavaScript.
Compare bordered vs borderless iframe styling (simulated):
Here’s a basic example demonstrating the use of the frameborder attribute within an <iframe> element:
<iframe src="example.html" frameborder="1" width="400" height="300"></iframe>In this example, frameborder="1" tells the browser to draw a border around the iframe, visually separating the embedded document from the parent page.
Most modern embeds remove the default border for a cleaner look:
<iframe
src="https://example.com/widget"
frameborder="0"
width="100%"
height="400"
title="Embedded widget"></iframe>
<!-- Modern CSS equivalent -->
<style>
iframe { border: none; }
</style>frameborder="0" removes the default iframe border. For new code, CSS border: none achieves the same result with more styling flexibility.
You can change the frameborder attribute dynamically based on user interaction:
<iframe id="dynamicFrame" src="example.html"></iframe>
<script>
var frame = document.getElementById("dynamicFrame");
frame.frameBorder = "0";
</script>The script sets frameBorder to "0" on the iframe, removing the border at runtime. You can toggle between "0" and "1" based on UI state.
title on iframes — Describes embedded content for screen reader users.0 hides border; 1 shows border.
Embedded document loads inside frame.
Visual separation from parent page.
Seamless or framed—your choice.
The frameborder attribute is widely supported on iframes despite being obsolete in HTML5. CSS borders work universally for modern styling.
Browsers honor frameborder; CSS is preferred for new code.
Bottom line: Use frameborder for legacy compatibility; prefer CSS border in new projects.
frameborder="0" or CSS for seamless embedstitle on every iframeborder in new HTML5 projectstitle on iframesframe.frameborder in JS (use frameBorder)Although frames are considered deprecated for page layout, the frameborder attribute remains relevant for controlling borders around iframes and legacy frame elements. Understanding how to use this attribute helps when maintaining older websites or working with simple embeds.
For new projects, combine borderless iframes with CSS styling and always include accessible title attributes on embedded content.
frameborderBookmark these before embedding iframes.
1 = border.
ValuesMain use today.
ScopeModern approach.
Best practiceJS camelCase.
Scriptiframe a11y.
A11y0 hides the border; 1 shows it.frameborder="0" or use CSS iframe { border: none; }.<iframe> and legacy <frame> elements.iframe.frameBorder = "0" (camelCase) or setAttribute("frameborder", "0").Practice borderless iframes with frameborder="0" in the Try It editor.
3 people found this page helpful