untitled

(John Hannent) #1
Lastly, if your graphic file is stored on the space shuttle, use this punctuation:

“file:///\\\\\\\/^^^\\outerspace\servr\PHOTOS\mause.jpg”

The same punctuation and conventions are used when specifying the src=
attribute to load a graphic into an HTML <img >element.

You might not see some of your graphics when you move your Web pages
from your local computer to a server to post them on the Internet. If that
happens, check file paths to ensure that the graphics files are located where
your code says they are. The simplest tactic is to just keep all dependency
files (such as graphics files) in the same directory as your .htm and .css files.
That way, you can use relative paths, meaning you don’t specify any path at
all in your code, just the filename. The browser understands it should look
for your graphics in the same path that it found the HTML file.

Combining Classes ......................................................................................


You can save yourself some time and trouble by defining classes that are
later combined, like adjectives combine with nouns. Say that you want some
of your paragraphs framed in green, some in blue, and others in pink. You
could create a separate class for each kind of paragraph, or you could be
clever and create a general border style class, and three additional classes
for the coloring. Here’s how it works. First, you create four styles, and then
you combine the class names in the HTML elements when you use the
class=attribute:

<HTML>
<HEAD>

<style>

.framed {
border: solid 3px red;
padding: 6px;}

.pink { background-color: pink; }
.blue { background-color: blue; }
.green { background-color: green; }

</style>
</HEAD>
<body>

326 Part V: The Part of Tens

Free download pdf