👀 Live Preview
Iframe with tall inline content and scrolling="auto" (legacy demo):
Content overflows the 100px height; scrollbars appear when needed. Prefer style="overflow:auto" in new code.

The scrolling attribute was used on <iframe> elements to control scrollbar visibility when embedded content was larger than the iframe’s width or height. It accepted yes, no, or auto. In HTML5 the attribute is obsolete and deprecated—use CSS overflow on the iframe instead.
Legacy embeds.
Obsolete in HTML5.
Three values.
Modern replacement.
iframe.scrolling.
Read old markup.
scrollingThe purpose of the scrolling attribute was to tell the browser whether an <iframe> should display scrollbars when the embedded document’s content overflows the iframe’s dimensions. This helped developers manage layout when embedding pages, widgets, or documents that might not fit the allotted space.
HTML5 replaced this HTML attribute with CSS. The mapping is straightforward: scrolling="yes" corresponds to overflow: scroll, scrolling="no" to overflow: hidden, and scrolling="auto" to overflow: auto.
Browsers may still reflect scrolling in the DOM for backward compatibility, but validators flag it as obsolete. Always prefer CSS overflow on <iframe> elements in modern web development.
Legacy syntax on an <iframe> (shown for recognition only—do not use in new projects):
<iframe
src="https://example.com/embed"
width="600"
height="400"
scrolling="auto"
title="Embedded content"
></iframe>Modern equivalent with CSS:
<iframe
src="https://example.com/embed"
width="600"
height="400"
style="overflow: auto;"
title="Embedded content"
></iframe><iframe> and legacy <frame> elements.yes, no, or auto (case-insensitive).auto.overflow instead.<div>, <body>, or other non-frame elements.title on iframes for accessibility.The scrolling attribute accepted three keyword values:
yes — Always show scrollbars in the iframe, even when content fits.no — Hide scrollbars; overflow content may be clipped and unreachable without other navigation.auto — Show scrollbars only when content overflows (browser decides).<!-- Legacy (avoid) -->
<iframe scrolling="yes" src="..."></iframe>
<iframe scrolling="no" src="..."></iframe>
<iframe scrolling="auto" src="..."></iframe>
<!-- Modern CSS mapping -->
<!-- yes → overflow: scroll -->
<!-- no → overflow: hidden -->
<!-- auto → overflow: auto -->| Goal | Legacy scrolling | Modern CSS |
|---|---|---|
| Scrollbars when needed | scrolling="auto" | overflow: auto |
| Always show scrollbars | scrolling="yes" | overflow: scroll |
| Hide scrollbars / clip | scrolling="no" | overflow: hidden |
| Applicable element | <iframe> | <iframe> or wrapper |
| JavaScript (legacy) | iframe.scrolling = "auto" | iframe.style.overflow = "auto" |
| Status in HTML5 | Obsolete | Recommended |
| Element | Supported? | Notes |
|---|---|---|
<iframe> | Obsolete | Primary use; use CSS overflow today |
<frame> | Obsolete | Legacy framesets; frames are obsolete entirely |
<div> | No | Use CSS overflow on the container |
<body> | No | Page scrolling uses CSS on html/body |
scrolling vs CSS overflow| Feature | scrolling | CSS overflow |
|---|---|---|
| Status | Deprecated | Standard |
| Where to apply | iframe attribute | iframe style or class |
| Flexibility | Three keywords only | auto, scroll, hidden, overlay, etc. |
| Validator | Flags as obsolete | Valid HTML5 + CSS |
| Use today? | No | Yes |
Legacy scrolling on iframe, the CSS overflow replacement, and setting scrollbar behavior dynamically with JavaScript.
Iframe with tall inline content and scrolling="auto" (legacy demo):
Content overflows the 100px height; scrollbars appear when needed. Prefer style="overflow:auto" in new code.
Historical markup you may encounter in older embeds:
<iframe
src="https://example.com/embed"
width="600"
height="400"
scrolling="yes"
title="Embedded page"
></iframe>In this example, scrolling="yes" forced scrollbars to remain visible inside the iframe viewport, even when the embedded page was smaller than the frame.
Control iframe overflow with CSS instead of the deprecated attribute:
<style>
.embed-frame {
width: 600px;
height: 400px;
overflow: auto; /* replaces scrolling="auto" */
border: 1px solid #cbd5e1;
}
.embed-frame--clip {
overflow: hidden; /* replaces scrolling="no" */
}
</style>
<iframe
class="embed-frame"
src="https://example.com/embed"
title="Embedded page"
></iframe>Apply overflow directly on the iframe or on a wrapper element. This gives you the same behavior as legacy scrolling values with better control and validator support.
Legacy code set scrolling at runtime; modern code sets style.overflow:
<iframe id="myIframe" src="..." title="Embed"></iframe>
<script>
var frame = document.getElementById("myIframe");
// Legacy (avoid in new code)
frame.setAttribute("scrolling", "auto");
// Modern replacement
frame.style.overflow = "auto";
</script>When toggling scrollbar behavior based on user actions, change CSS overflow rather than the obsolete scrolling attribute. The DOM property may still exist for compatibility but should not be set in new projects.
title describes the embedded content for assistive technology.overflow: hidden, confirm no essential information is cut off.yes, no, or auto.
Controls scrollbar display.
CSS overflow replaces it.
Same control, modern markup.
The scrolling attribute is obsolete. Browsers may still honor or reflect it for backward compatibility, but it is not part of modern HTML5. CSS overflow is supported everywhere.
Legacy attribute may still work in some browsers; CSS overflow is the reliable modern approach.
Bottom line: Recognize it in legacy embeds; replace with CSS overflow in new projects.
overflow: auto on iframes for modern scrollbar controltitle on every iframescrolling when refactoring legacy pagesscrolling to new iframe markupscrolling="no" to hide content users still need to accessscrolling="yes" works identically in all modern browsersbody { overflow }sandbox and security reviewThe scrolling attribute was a useful legacy tool for managing scrollbar visibility inside <iframe> elements. It is obsolete in HTML5 and should not appear in new documents.
Use CSS overflow for the same control with better flexibility and standards compliance. Understanding the old yes, no, and auto values helps when maintaining or migrating older embedded content.
scrollingBookmark these before editing legacy iframes.
Obsolete in HTML5
StatusLegacy use only
ElementThree values
ValuesModern replacement
ReplaceKeep content reachable
A11y<iframe> elements when embedded content overflowed. Values were yes, no, and auto. It is obsolete in HTML5.<iframe> and legacy <frame> elements. Not on divs or the page body.overflow: auto, overflow: scroll, or overflow: hidden on the iframe element.yes always showed scrollbars. auto showed them only when content overflowed. Map to overflow: scroll and overflow: auto respectively.iframe.scrolling or setAttribute("scrolling", ...). Prefer iframe.style.overflow in new code.Compare legacy scrolling with CSS overflow in the Try It editor.
5 people found this page helpful