Home HTML Attributes scrolling Definition
Definition and Usage The scrolling attribute on <iframe> once chose when scrollbars appeared for the frame: auto (when content overflows), yes (always), or no (never).
MDN lists scrolling as deprecated . Prefer CSS overflow (and overflow-x / overflow-y) instead of this presentational HTML attribute. Related legacy frame chrome: frameborder , marginwidth .
Deprecated / obsolete. Do not ship scrolling on new pages. Recognize it in old markup, then migrate to CSS overflow.
Syntax
HTML Syntax <!-- obsolete --> <iframe src="…" scrolling=" auto|yes|no ">
<!-- modern --> iframe { overflow: auto | scroll | hidden; }
If you control the framed document, you can also set overflow on that page’s html / body.
Values
Attribute Values Legacy values and CSS stand-ins:
Value Legacy meaning Modern CSS Try it autoScrollbars only when needed (typical default) overflow: auto Try ityesAlways show scrollbars overflow: scroll Try itnoNever show scrollbars (content may clip) overflow: hidden Try it
Try it
Live Preview Pick a legacy mode. The demo uses CSS overflow (modern) on an iframe with tall srcdoc content — not the obsolete attribute.
Code
HTML Examples Legacy vs modern. Prefer the CSS snippets for real projects.
1. auto 2. yes → scroll 3. no → hidden Example 1 — auto → overflow: auto Scrollbars only when the framed content is taller/wider than the box.
<!-- obsolete -->
<iframe title="Demo" src="…" scrolling="auto"></iframe>
<!-- modern -->
<iframe title="Demo" srcdoc="<p>…tall content…</p>"
style="height:6rem;overflow:auto"></iframe> How It Works Legacy auto meant "scroll if needed."overflow: auto is the CSS equivalent.srcdoc supplies tall content for a self-contained demo.title keeps the frame accessible.Example 2 — yes → overflow: scroll Always reserve scrollbars (even if content fits).
<!-- obsolete -->
<iframe title="Forced bars" scrolling="yes" src="…"></iframe>
<!-- modern -->
<iframe title="Forced bars" srcdoc="<p>Short</p>"
style="height:6rem;overflow:scroll"></iframe> How It Works scrolling="yes" forced visible scroll UI.overflow: scroll does the same in CSS.Short content may still show inactive bars (UA-dependent).Rarely needed — auto is usually better UX.Example 3 — no → overflow: hidden Hide scrollbars; overflowing content is clipped (users cannot scroll).
<!-- obsolete -->
<iframe title="No bars" scrolling="no" src="…"></iframe>
<!-- modern -->
<iframe title="No bars" srcdoc="<p>…tall…</p>"
style="height:6rem;overflow:hidden"></iframe> Lower lines are clipped — no scrollbar.
How It Works scrolling="no" hid scrollbars.overflow: hidden clips overflow instead.Accessibility risk: users may lose access to clipped content.Prefer sizing the frame or allowing scroll when content can grow. Edge Cases & Pitfalls Most issues are using presentational HTML or hiding overflow that users still need.
deprecated Validators flag scrolling Remove it; restyle with CSS.
cross-origin You cannot style another site’s body For third-party embeds, CSS on the iframe box is what you control (plus attributes like sandbox).
a11y overflow: hidden can hide contentOnly clip when overflow is intentional decoration, not required reading.
chrome Related legacy attrs frameborder, marginwidth, marginheight are also deprecated — use CSS.
Compatibility
Browser Support scrolling is a deprecated HTML attribute on <iframe>. Do not use it in new projects.
✓ Deprecated — use CSS
scrolling Legacy recognition varies. Style overflow with CSS for consistent, maintainable results.
Google Chrome Legacy*
Prefer CSS
Mozilla Firefox Legacy*
Prefer CSS
Apple Safari Legacy*
Prefer CSS
Microsoft Edge Legacy*
Prefer CSS
Opera Legacy*
Prefer CSS
Samsung Internet Legacy*
Prefer CSS
Internet Explorer Yes
Legacy support scrolling Deprecated
Bottom line: *May still parse for old pages. New iframes: CSS overflow only — never add scrolling.
Remember
Key Takeaways Was: iframe scrollbar mode (auto / yes / no).
Now: CSS overflow (auto / scroll / hidden).
Prefer auto unless you intentionally clip or force bars.
Deprecated — do not add to new HTML.
One line: scrolling controlled iframe scrollbars — obsolete; use CSS overflow.
Frequently Asked Questions What was the HTML scrolling attribute? On iframe, scrolling chose when scrollbars appeared: auto (when needed), yes (always), or no (never).
Should I use scrolling today? No. MDN lists it as deprecated. Control overflow with CSS instead of the presentational HTML attribute.
What replaces scrolling="no"? Use CSS overflow: hidden (often on the iframe, or on the embedded document’s html/body when you control that page).
What replaces scrolling="yes"? Use CSS overflow: scroll to always reserve scrollbars.
What is the default? Historically auto — show scrollbars only when content overflows. That remains the usual CSS default behavior with overflow: auto.
Is scrolling the same as CSS overflow on a div? Same idea (clip vs scroll), but scrolling was an iframe-only HTML attribute. Prefer CSS on modern pages.
Next: selected Pre-select an option in a select or datalist-friendly control.
selected tutorial → About the author Developer, cloud engineer, and technical writer
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
Helpful Share Copy link Suggestion