HTML iframes : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

iframes
Iframes are like Windows into which you can pour an entire separate document. They may optionally have scrolling. They are not universally supported and are not permitted in strict DTDs (Document Type Definitions). The latest Chrome, Opera, Firefox and SeaMonkey IE (Internet Explorer) all support them. There are typically used to contain ads, such as the one on the right: Here is the code to generate For some reason you must use a separate </iframe> tag. You can’t say <iframe … />. You cannot leave out the width and height parameters and have it shrink-grow to fit the inclusion.

The Referenced Snippet

The html you insert into the frame must be a complete web page, not just a fragment. It needs a minimal header with
Iframe Tags
Attribute Value Description
align left
right
top
middle
bottom
Specifies how to align the entire iframe relative to the surrounding text.
class I have found that classes applied to an iframe are ignored. So I put the whole <iframe …>…</iframe> in a <div class=iframe>…</div > sandwich to give me a handle to control the iframe’s properties. Life gets complicated with the Russian dolls of nested containers. You will just have to experiment to get the effects you want.
frameborder 1
0
Specifies whether or not to display a frame border.
height pixels
%
Defines the height of the iframe. Includes the height of the horizontal scroll bar if any. It also must include room for padding and margins around the components enclosed. Oddly, even when you have scrolling=no you must still include room for the horizontal scroll bar. The display will be not as tall as you request. This way you can add or remove scrolling without changing the size of the payload window. You specify the size of the window including the possibly invisible scroll bars. If you leave this out, the browser will pick something, which may or may not be reasonable.
id Usually the same as the name. Used by CSS (Cascading Style Sheets) to refer to this block of text.
longdesc URL (Uniform Resource Locator) An URL to a long description of the frame contents, not the long description itself.
marginheight pixels Defines the top and bottom margins of the iframe. Oddly 0 is an illegal value. Leave marginheight out altogether for 0.
marginwidth pixels Defines the left and right margins of the iframe. Oddly 0 is an illegal value. Leave marginwidth out altogether for 0.
name frame_name Specifies a unique name, within the page, of the iframe (to use in scripts).
scrolling yes
no
auto
Define scroll bars. I found that when you scroll the coloured background is only as big as in the initial window. I could not get backgrounds to work properly and eventually used a transparent background to mask the error. Opera will let you scroll without scroll bars even if you specify scroll=no. Firefox will not.
src URL The URL of the document to show in the iframe.
style Not necessarily supported.
title Explains what iframe is for. Not displayed.
width pixels
%
Defines the width of the iframe. Includes the width of the vertical scroll bar if any. It also must include room for padding and margins around the components enclosed. If you leave this out, the browser will pick something, which may or may not be reasonable.

This page is posted
on the web at:

http://mindprod.com/jgloss/htmliframes.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\htmliframes.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.197.171.35]
You are visitor number