|
|
|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98
PARAM assigns a value to any required applet-dependent variable. The variable name is specified via the NAME attribute, while the value for this variable is specified by VALUE. NAMEs and VALUEs are, of course, entirely specific to the applet being invoked: The applet must understand the names so that it knows what to do with the values. The attributes are:
- NAME=string (mandatory) Specifies a name to be associated with this parameter when the object or applet is run. Thus, NAMEs must be understood by the associated applet or embedded object. Names may or may not be case-sensitive, depending on the applet.
- TYPE=mime-type (optional) Specifies the MIME type of the resource specified by VALUE for the cases where VALUE is a URL.
- VALUE=string (optional) Specifies the value to associate with the given name. Again, the value must be meaningful to the specified applet. If a value is not needed, this attribute can be left out.
- VALUETYPE=data, ref, object (optional; valid only for PARAM inside OBJECT) Specifies the type of the value attribute and determines how the browser parses the data before passing it to the object. VALUETYPE has no meaning inside an APPLET. The value data means that the VALUE string is data to be passed to the object and that HTML entity and character references must be replaced by the referenced characters before the string is sent. The value object means that the assigned string is a reference pointing to another (possibly running) OBJECT within the same document. The value ref indicates that the value is a proper URL referencing a resource. If VALUETYPE=ref, then the optional TYPE attribute can specify the MIME type of the referenced object.
NOTE: Limited Support for TYPE and VALUETYPE
Microsoft Internet Explorer 3 does not support the TYPE and VALUETYPE attributes.
IMG Element: Inline Images
Usage:
| <IMG>
|
Can Contain:
| empty
|
Can Be Inside:
| ADDRESS, BLOCKQUOTE, BODY, CAPTION, CENTER, DD, DIV, DT, FIELDSET, FORM, Hn, LI, NOFRAMES, NOSCRIPT, P, TD, TH,
| character highlighting, A, APPLET, BUTTON, IFRAME, LABEL, LEGEND, OBJECT
|
Attributes:
| CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers,
onAbort, onError, onLoad,
|
| ALIGN, ALT, BORDER, HEIGHT, HSPACE, ISMAP, LONGDESC, LOWSRC, NAME, SRC, USEMAP, VSPACE, WIDTH, (SUPPRESS: Netscape Navigator 4), (CONTROLS, DYNSRC, LOOP, START: Internet Explorer only)
| |
IMG includes an image file inline with the document text, the image file being specified by the SRC attribute. There are currently four common image formats used for inline images. These are: GIF format (with the filename suffix .gif); X-Bitmaps (with the filename suffix .xbm); X-Pixelmaps (with the filename suffix .xpm); and JPEG format (filename suffix .jpeg or .jpg). A fifth format, Portable Network Graphics or PNG (with the filename suffix .png), is expected to be widely supported by the next generation of browsers. It is currently supported only by Internet Explorer 4.
To a large extent, images within a document are treated like words or characters, and you can place an image almost anywhere you have regular text. The exception is the PRE (preformatted text) element, which should not contain IMG elements. Images can also float on the page, allowing text to flow around them. This is facilitated with special ALIGN attribute options, outlined in this section.
IMG supports the standard generic and event-handler attributes described earlier in this chapter. Note that the event handlers are only partially supported by current browsers.
The IMG element takes three main attributes. SRC is mandatory and specifies the URL of the image file to be included. ALIGN specifies the alignment of the image with respect to the surrounding text, and ALT gives an alternative text string for browsers that cannot display images. There are several other attributes, as well as some Netscape- and Microsoft-specific extensions as discussed in this section. Some examples of IMG elements and image alignment are shown in Figures 6.43 and 6.44.
Note that the attributes ALIGN, BORDER, HEIGHT, HSPACE, VSPACE, and WIDTH are purely presentational and that equivalent formatting can be specified using a style sheet. Thus, HTML 4 recommends dropping these attributes in favor of using style sheets.
- ALIGN=bottom, left, middle, right, top, (texttop, absmiddle, baseline, absbottom: Netscape extensions) (optional) Specifies the alignment of the image with the neighboring text. Bottom aligns the bottom of the image with the baseline of the surrounding textthis is the default. Middle aligns the middle of the image with the baseline of the text, and top aligns the top of the image with the top of largest item in a line (including other images). Note that text does not wrap around an image aligned using the top, middle, or bottom attribute values, so that images within a sentence can create big gaps between adjacent lines.
- The values left and right allow for text flow around an image. ALIGN=left floats the image below any text that precedes the IMG element and over to the left margin and allows subsequent text to flow around the right side of the image. ALIGN=right floats the image to the right side of the window and allows subsequent text to flow around the left side of the image. Browsers that do not understand these values assume the ALIGN=bottom default.
- Netscape Navigator (and several other browsers) support additional align values to better control alignment within a line of text. ALIGN=texttop aligns the top of an image with the top of the surrounding text, independent of any other images that may appear inline. ALIGN=middle aligns the middle of the image with the baseline of the adjacent line of text, while ALIGN=absmiddle aligns the middle of an image with the middle of the region defined by the line of text plus any other inline images. ALIGN=baseline aligns the bottom of an image with the baseline of the line of textthis is the same as ALIGN=bottom, but with a clearer meaning. ALIGN=absbottom aligns the bottom of the image with the bottom of the line (for example, the bottom tip of a letter such as q, or the bottom of another inline image that hangs down below the text baseline).
- ALT=string (optional) Specifies a text alternative to the image, for use by text-only browsers. This should always be included to let users with text-only browsers know what they are missing, or to let graphical browsers preview the image using this text description. If the image is purely decorative and warrants no description, you should enter a null string using the form ALT=.
- BORDER=number (optional) Specifies the border width, in pixels, around images that are marked as hypertext anchors (recall that images are generally surrounded by a colored border, if they are inside an anchor). BORDER=0 implies no border around the image and allows for clickable imagemaps or buttons without surrounding border. BORDER is illustrated in Figures 6.45 and 6.46. Note that BORDER can also be used to draw borders around images that are not inside A elements.
- In general, element borders are better handled using style sheets, and this is the recommended mechanism.
- CONTROLS (optional; Internet Explorer only) Indicates that a set of video or VRML controls should be displayed along with the inline viewer. If CONTROLS is absent, then the controls are not displayed. Note that the use of IMG to display video or VRML data should be avoided, in favor of using OBJECT.
- DYNSRC=url (optional; Internet Explorer only) Specifies the URL of an AVI-format video clip or a VRML world description file to be included inline with the document. The attributes CONTROLS, LOOP, LOOPDELAY, and START are used to control the behavior of the video clip or VRML scene. Both DYNSRC and SRC can be specified in the same IMG element, so that DYNSRC-incapable browser can display a regular image file in place of the VRML data or video sequence.
- Note that the use of IMG to display video or VRML data should be avoided, in favor of using OBJECT.
|