A scrollable iframe is a Hypertext Markup Language (HTML) element that defines a content area, which visitors can move up and down and left and right. This frame presents an external web page, and the scroll capability permits viewers to see all of the page's information. Scrollable iframes are an ideal solution for webmasters who wish to present pages of related text but do not want viewers to leave the site.
Creating the initial iframe is accomplished by entering <iframe></iframe> tags that build the contained space. The opening <iframe> element contains the "src” attribute, which stands for “source.” The Uniform Resource Locator (URL) address follows that to specify the location of the iframe’s external web page. For example: <iframe src="http://www.wisegeek.com">.
To make the iframe scrollable, a scrolling descriptor is added to the first tag with "yes" as the value. This attribute instructs the web browser to automatically provide scroll bars on the right and bottom sides of the iframe. The user clicks and drags these bars to view scrollable text and other content not presently in view. To illustrate: <iframe scrolling="yes">.
The display of the scrollable iframe is customizable by specifying its dimensions in pixels or percentages in the opening tag. Entering a width value controls the left to right measurement of the space, and supplying a height manages the top to bottom display. For instance: <iframe width="600" height="300">.
Other attributes of the scrollable iframe tag also provide instruction for how it should appear in a browser window. These descriptors are optional, but they provide greater customization of the movable iframe on the page. Some of the most common descriptors include frameborder, marginheight and marginwidth.
The frameborder descriptor determines whether the iframe bears an outline around its container. This border encompasses the iframe content as well as the scroll bars. A value of 1 instructs the browser to display this border, and a value of 0 does the opposite.
Marginheight and marginwidth attributes also design the look of a scrollable iframe. Each descriptor requires a number value in pixels to determine the margin space at the top and bottom of the container. These attributes are especially useful when extra padding is needed between web page elements.
Although the scrollable iframe is supported in major browsers, an HTML paragraph typically is inserted between the iframe tags to display a message in the event that the inline frame does not render correctly. The paragraph might contain a message, such as "Your browser does not display Iframes," or present a link to the external website containing the information. Any paragraph code goes between the <iframe></iframe> tags, as in this example: <iframe><p>Your browser does not display iframes.</p></iframe>.