HTML scrolling Attribute

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

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.

HTML Syntax

syntax.html
<!-- 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.

Attribute Values

Legacy values and CSS stand-ins:

ValueLegacy meaningModern CSSTry it
autoScrollbars only when needed (typical default)overflow: autoTry it
yesAlways show scrollbarsoverflow: scrollTry it
noNever show scrollbars (content may clip)overflow: hiddenTry it

Live Preview

Pick a legacy mode. The demo uses CSS overflow (modern) on an iframe with tall srcdoc content — not the obsolete attribute.

Tall content inside a short frame. Prefer CSS — do not add scrolling in production.

iframe

CSS: overflow: auto (stand-in for scrolling="auto")

HTML Examples

Legacy vs modern. Prefer the CSS snippets for real projects.

Example 1 — auto → overflow: auto

Scrollbars only when the framed content is taller/wider than the box.

HTML
<!-- obsolete -->
<iframe title="Demo" src="…" scrolling="auto"></iframe>

<!-- modern -->
<iframe title="Demo" srcdoc="<p>…tall content…</p>"
  style="height:6rem;overflow:auto"></iframe>
Try It Yourself

How It Works

  1. Legacy auto meant "scroll if needed."
  2. overflow: auto is the CSS equivalent.
  3. srcdoc supplies tall content for a self-contained demo.
  4. title keeps the frame accessible.

Example 2 — yes → overflow: scroll

Always reserve scrollbars (even if content fits).

HTML
<!-- obsolete -->
<iframe title="Forced bars" scrolling="yes" src="…"></iframe>

<!-- modern -->
<iframe title="Forced bars" srcdoc="<p>Short</p>"
  style="height:6rem;overflow:scroll"></iframe>
Try It Yourself

How It Works

  1. scrolling="yes" forced visible scroll UI.
  2. overflow: scroll does the same in CSS.
  3. Short content may still show inactive bars (UA-dependent).
  4. Rarely needed — auto is usually better UX.

Example 3 — no → overflow: hidden

Hide scrollbars; overflowing content is clipped (users cannot scroll).

HTML
<!-- obsolete -->
<iframe title="No bars" scrolling="no" src="…"></iframe>

<!-- modern -->
<iframe title="No bars" srcdoc="<p>…tall…</p>"
  style="height:6rem;overflow:hidden"></iframe>
Try It Yourself

How It Works

  1. scrolling="no" hid scrollbars.
  2. overflow: hidden clips overflow instead.
  3. Accessibility risk: users may lose access to clipped content.
  4. 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 content

Only clip when overflow is intentional decoration, not required reading.

chrome

Related legacy attrs

frameborder, marginwidth, marginheight are also deprecated — use CSS.

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.

N/A Authoring status
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.

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

On iframe, scrolling chose when scrollbars appeared: auto (when needed), yes (always), or no (never).
No. MDN lists it as deprecated. Control overflow with CSS instead of the presentational HTML attribute.
Use CSS overflow: hidden (often on the iframe, or on the embedded document’s html/body when you control that page).
Use CSS overflow: scroll to always reserve scrollbars.
Historically auto — show scrollbars only when content overflows. That remains the usual CSS default behavior with overflow: auto.
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

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