HTML and CSS Reference
In-Depth Information
Embedding Other Objects
So far in this tutorial, you've embedded sound clips, video clips, and Java applets. In fact,
any type of content can be embedded using the object element; the original vision of
the object element was to act as a general container for any content not directly entered
into the HTML code of the Web page. Maxine suggests that you explore a few examples.
Inserting Inline Images
You can use the <object> tag to insert all of your inline images. One advantage of enter-
ing images as embedded objects is that you can apply markup tags for the alternate text.
For example, the inline image
<img src=”jplogo.jpg” alt=”Jumbo Popcorn”
width=”300” height=”200” />
can be replaced with the following embedded object:
<object data=”jplogo.jpg” type=”image/jpeg”
width=”300” height=”200”>
<h1>Jumbo Popcorn</h1>
Another advantage of treating images as embedded objects is that you can provide
users with different formats of the same graphic image. For example, the code
<object data=”jplogo.png” type=”image/png”>
<object data=”jplogo.jpg” type=”image/jpg”>
<h1>Jumbo Popcorn</h1>
allows browsers to first display the Jumbo Popcorn logo in PNG format. If a browser does
not support that format, the browser displays the logo as a JPEG. Finally, if the browser
does not support either format or is a non-graphical browser, it displays the text Jumbo
Popcorn marked as an h1 heading.
You also can nest videos and inline images. For example, you can embed a video clip
and nest an image object within the video clip, allowing browsers to choose which type
of object to display.
Embedding an HTML File
Web pages themselves can be embedded as objects. To embed a Web page, you use the
<object> tags
<object data=” url ” type=”text/html”
width=”value” height=”value”>
where url is the URL of the HTML file to be embedded. When you embed a Web page,
that file is displayed within the dimensions specified by the width and height attributes.
Browsers automatically add horizontal and vertical scroll bars to allow users to scroll
around the document. Figure 7-43 shows an example that Maxine might want to use on
the Jumbo Popcorn Web site, showing a preview of the contents of the IMDB Web site
( ) de scribing Royal Wedding .
Search WWH ::

Custom Search