Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Workshop

Quiz

  1. How would you insert an image file named elephant.jpg at the very top of a Web page?
  2. How would you make the word Elephant appear whenever the actual elephant.jpg image couldn't be displayed by a Web browser?
  3. Write the HTML to make the elephant.jpg image appear on the right side of the page, with a big headline reading "Elephants of the World Unite!" on the left side of the page next to it.
  4. Write the HTML to make a tiny image of a mouse (named mouse.jpg) appear between the words "Wee sleekit, cow'rin," and the words "tim'rous beastie".
  5. Suppose you have a large picture of a standing elephant named elephant.jpg. Now make a small image named fly.jpg appear to the left of the elephant's head and mouse.jpg appear next to the elephant's right foot.

Answers

  1. Copy the image file into the same directory folder as the HTML text file, and type <img src="elephant.jpg" /> immediately after the <body> tag in the HTML text file.
  2. Use the following HTML:
    <img src="elephant.jpg" alt="elephant" />
  3. <img src="elephant.jpg" align="right" />
    <h1>Elephants of the World Unite!</h1>
    								
  4. Wee sleekit, cow'rin,<img src="mouse.jpg" />tim'rous beastie
    								
  5. <img src="fly.jpg" align="top" />
    <img src="elephant.jpg" />
    <img src="mouse.jpg" />
    								

Exercise

  • Try using any small image as a "bullet" to make lists with more flair. If you also want the list to be indented, use the <dl> definition list and <dd> for each item (instead of <ul> and <li>, which would give the standard boring bullets). Here's a quick example, using the star.gif file from my sample images page:
    <dl><dd><img src="star.gif">A murder of crows
    <dd><img src="star.gif">A rafter of turkeys
    <dd><img src="star.gif">A muster of peacocks</dl>

Share ThisShare This

Informit Network