HTML scrolling Attribute

The obsolete HTML scrolling attribute was historically used with frames to indicate whether scrollbars should be displayed when the embedded content was larger than the available viewing area.

Historical Syntax

The scrolling attribute was commonly placed on an <iframe> or the obsolete <frame> element.

<iframe src="example.html" scrolling="yes" title="Example Content"></iframe>

The attribute told supporting browsers whether scrollbars should be available for the frame.

Historical Values

The scrolling attribute traditionally accepted three values.

Value Historical Effect
yes Requested scrollbars for the frame.
no Requested that scrollbars not be displayed.
auto Allowed the browser to provide scrollbars when they were needed.

Historical Elements

The obsolete scrolling attribute was historically associated with frame-based content.

Element Historical Purpose
<iframe> Controlled whether scrollbars were provided for an inline frame.
<frame> Controlled whether scrollbars were provided for a frame in an obsolete frameset layout.

Historical Use

Frames display another document inside a limited viewing area. When the embedded document was larger than that area, the scrolling attribute allowed authors to influence whether users could scroll through the additional content.

<iframe src="example.html"
        scrolling="auto"
        width="400"
        height="200"
        title="Example Content">
</iframe>

With scrolling="auto", the browser could provide scrolling when the embedded document did not fit within the available frame area.

Using scrolling="no" could make content inaccessible when the embedded document was larger than its frame, because users might have no way to reach the hidden content.

Why It Became Obsolete

The scrolling attribute mixed presentation and layout behavior with HTML markup. Modern webpages use CSS for controlling overflow and scrolling behavior where the author controls the content and layout.

The obsolete <frame> and <frameset> layout system should no longer be used. The <iframe> element remains part of modern HTML for embedding another document, but its obsolete scrolling attribute should be omitted.

Modern Alternative

For ordinary page content, use the CSS overflow, overflow-x, and overflow-y properties to control what happens when content is larger than its container.

Historical HTML

<iframe src="example.html"
        scrolling="auto"
        title="Example Content">
</iframe>

Modern CSS Overflow

.scrollable-content {
  height: 150px;
  overflow: auto;
}

With overflow: auto, a container can become scrollable when its content is larger than the available space.

Play in Editor

Learn More About CSS Overflow

The CSS tutorials explain how overflow and scrolling can be controlled in modern layouts:

  • CSS Overflow - Control what happens when content extends beyond an element's available space.

Legacy Browser Support

The scrolling attribute was widely associated with older frame and iframe markup and may still affect legacy content in some browsers.

Modern webpages should not depend on the attribute. Omit scrolling from current <iframe> markup and use modern layout techniques appropriate to the embedded content.

For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.

Other obsolete attributes historically associated with frames and inline frames include:

  • frameborder - Historically controlled whether a frame border was displayed.
  • framespacing - Historically controlled spacing between frames.
  • marginheight - Historically controlled vertical spacing inside a frame.
  • marginwidth - Historically controlled horizontal spacing inside a frame.
  • noresize - Historically prevented users from resizing frames.

Specifications

The scrolling attribute on <iframe> and the obsolete <frame> element should not be used in modern HTML. Current webpages should use modern HTML and CSS layout techniques instead. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.