HTML and CSS Reference
Most browsers interpret the string you include in the alt attribute as a literal string. That
is, if you include any HTML tags in that string, they'll be printed as-is rather than being
parsed and displayed as HTML code. Therefore, you can't use whole blocks of HTML
code as a replacement for an image—just a few words or phrases.
I bring up image alternatives now for good reason. The alt attribute is required in
XHTML 1.0 but is optional in HTML5 . If there's no appropriate alternative text for an
image, you can simply leave it empty, like this: alt=““ .
Task: Exercise 9.1: Adding Images to a Page
Here's the web page for a local haunted house that's open every year at Halloween.
Using all the excellent advice I've given you in the preceding eight lessons, you should
be able to create a page like this one fairly easily. Here's the HTML code for this HTML
file, and Figure 9.1 shows how it looks so far:
<title> Welcome to the Halloween House of Terror </title>
<h1> Welcome to The Halloween House of Terror </h1>
Voted the most frightening haunted house three years in a
row, the <strong> Halloween House of Terror </strong>
provides the ultimate in Halloween thrills. Over
<strong> 20 rooms of thrills and excitement </strong > to
make your blood run cold and your hair stand on end!
The Halloween House of Terror is open from <em> October 20
to November 1st </em> , with a gala celebration on
Halloween night. Our hours are:
<li> Mon-Fri 5PM-midnight </li>
<li> Sat & Sun 5PM-3AM </li>
<li><strong> Halloween Night (31-Oct)</strong>: 3PM-??? </li>
The Halloween House of Terror is located at: <br />
The Old Waterfall Shopping Center <br />
1020 Mirabella Ave <br />