HTML and CSS Reference
In-Depth Information
Modify the h2 selector as follows:
Let's review working with the CSS padding property. Add a style rule to configure
10 pixels of padding on the left side of the h2 element. The new style rule follows:
padding-left: 10px;
Save your page as index.html in the trilliumch4 folder. Launch a browser and test your
page. It should look similar to the one shown in Figure 4.16. Note : if the image did not
display on your Web page, verify that you have saved the trilliumbanner.jpg file in the
trilliumch4 folder and that you have spelled the file name correctly in the <img />
element. The student files contain a sample solution in the Chapter4/4.3 folder. Isn't it
interesting how just one image can add visual interest to a Web page?
Image Links
The XHTML to make an image function as a hyperlink is very easy. To create an image
link all you need to do is surround your <img /> element with anchor tags. For example,
to place a link around an image called home.gif, use the following XHTML code:
<a href="index.html"><img src="home.gif" height="19" width="85"
alt="Home" /></a>
When an image is used as a hyperlink, the default is to show a blue outline (border)
around the image. If you would prefer not to display this outline, you could use the
border="0" attribute in your image tag as follows:
<a href="index.html"><img src="home.gif" height="19"
width="85"alt="Home" border="0" /></a>
A more modern approach is to use CSS to configure the border on the img selector. The
next Hands-On Practice will demonstrate this technique as you add image links to a
Web page.
HANDS-ON PRACTICE 4.4
You will add image links to the Trillium Media Design Home page in this Hands-On
Practice. You should already have the index.html and trilliumbanner.jpg files in your
trilliumch4 folder. The graphics used in this Hands-On Practice are located in the stu-
dent files: Chapter4/starters folder. Save the home.gif, services.gif, and contact.gif files
to your trilliumch4 folder. View Figure 4.17 to see how your page should look after you
are done with this Hands-On Practice.
Let's get started. Launch a text editor and open index.html. Notice that the anchor tags
are already coded—you'll just need to convert the text links to image links! However,
before you start changing the code, let's take a minute to discuss accessibility. Whenever
the main navigation consists of media, such as an image, some individuals may not be
able to see the images (or may have images turned off in their browser). To provide
Focus on Accessibility
WWW
 
Search WWH ::




Custom Search