<OBJECT> element, and PNG graphics-files


The <OBJECT> element.

This has been suggested by W3C as an alternative to the <IMG> tag for in-lining images; and recommended to supersede the <APPLET> element for Java objects.
Its potential flexibility implies that it may become used for yet more types of "object" in the future.

The syntax is:

 <OBJECT attributes> Alternative action </OBJECT>
where "attributes" are described below; and "Alternative action" is skipped over unless the <OBJECT> is not implemented -- in this case, it is equivalent to the ALT= attribute in an <IMG> tag except that it is not restricted to text, but can be (almost) any valid HTML, even including a further <OBJECT> element (as it is allowed to be nested).

Attributes for any type of Object

WIDTH=
width of rendered area in pixels;
HEIGHT=
height of rendered area in pixels.

BORDER=
width of border line drawn round area ("0" for none).

HSPACE=
horizontal gutter in pixels;
VSPACE=
vertical gutter in pixels.

ALIGN=
vertical or horizontal alignment, eg "top", "left" etc.

STANDBY=
text to display while fetching/loading object.

Attributes for graphics/images

TYPE=
specifies the type of image file, eg "image/gif", "image/jpeg" or "image/png".

DATA=
gives the URL reference to the image file, eg "piccy.gif" or "../images/photo.jpeg" etc.

Attributes for code applets

CODETYPE=
specifies the particular "language" the applet is coded in (ie it is not restricted to just Java).

CLASSID=
specifies the URL reference to the applet code;
CODEBASE=
specifies the Base URL if CLASSID was just a leafname not in the current directory.

DATA=
specifies the URL reference to data for the code (if required).


PNG image files.

This stands for "Portable Network Graphic"; and is pronounced "Ping".

W3C propose that this file format could replace the current GIF format, for two main reasons:

This brief overview of the PNG format indicates:

Basic features:

Extended features:

Additional features:

Things it doesn't do:

Creating PNG files.

A program specifically for this is Tom Tanner's !Png2Spr, specifically version 1.24 or higher (note that earlier versions only convert from PNG to Sprite; the later versions are bidirectional): this was on the cover disk of the March 1998 issue of Acorn User (not the January issue, which was corrupt); it is also available from his website:
<http://www.argonet.co.uk/users/ttehtann/>.
The latest versions of John Kortink's !Creator can also generate PNGs.

Should I use them from now on everywhere?

Bearing in mind that it is only a comparatively recent W3C proposal, it would be unwise to assume that ALL browsers can render PNGs; and you wouldn't want your website-visitor to be disappointed!

But it is reasonable to guess that:

so you can get round this by using <OBJECT> to contain your PNG, with its "alternative content" referencing an ordinary GIF (or JPEG) in a standard <IMG> tag . . . . . . keep reading!


Using a PNG inside <OBJECT>

Assume that you have created an artistic masterpiece as a PNG file called "thing/png"; and that you also have a GIF version of the same image as "thing/gif".
Consider the following fragment of HTML:
   <OBJECT TYPE="image/png" DATA="thing.png">
     <IMG SRC="thing.gif" ALT="Wot no piccy">
   </OBJECT>
where both the <OBJECT> and <IMG> tags should also include the appropriate WIDTH= and HEIGHT= attributes; and could also include any of ALIGN= or BORDER= or HSPACE= or TITLE= or VSPACE= attributes.

Different browsers may interpret this in the following ways:

(The same could be done with a JPEG instead of the GIF in the example)


John Alldred <john@protovale.co.uk> 28May98
http://www.protovale.co.uk/john/

Back to Home Page . . . . . . Back to "Tutors" page