150 likes | 268 Views
Images, Hyperlinks, and Sound. LESSON 3. Module 2: XHTML Basics. Lesson Overview In this lesson, you will learn to: Manipulate XHTML code using Notepad. View Web pages created using XHTML code using a browser. Insert images using XHTML code into a Web page.
E N D
Images, Hyperlinks, and Sound LESSON 3 Module 2: XHTML Basics
Lesson Overview • In this lesson, you will learn to: • Manipulate XHTML code using Notepad. • View Web pages created using XHTML code using a browser. • Insert images using XHTML code into a Web page. • Create hyperlinks using XHTML code. • Add sound to your Web page.
Guiding Questions for Lesson 3 • Besides text, what other elements are common to Web pages? • What is the difference between a Web page and a Web site?
Adding Excitement to Your Web page Look at your “Tags and Attributes” Web page in a browser. What do you see on your Web page? What could you add to your Web page to make it more exciting?
Images Visual representations include: Graphics Photographs Graphs Drawings What images do you have on your computer right now that could be used in your Web site?
The IMAGE Element • To place an image into a Web page the <img /> tag is used • Here is an example: • <img src=“picture.jpg” /> • The tag tells the Web page to display the image named picture.jpg.
Finding an Image Path Open the folder containing the image file. Right-click on the image. Choose “Properties” from the menu.
Finding an Image Path In the “Properties” dialog box, look for “Location.” Copy and paste this location inside the quotation marks. Add a backward slash (\) and the image file name to the location path.
Example of an Image tag <img src=“C:\Documents and Settings\Owner.FAMILYROOM\My Documents\My Pictures\picture.jpg” height=“100” width=“100” alt=”My Image” /> The image is located on the computer at C:\Documents and Settings\Owner.FAMILYROOM\My Documents\My Pictures\picture.jpg Attributes have been added Size of the image defined by height and width Alt tag – used by browsers that “speak” the words on the Web page
Using Hyperlinks Connect a Web page to other Web sites and Web pages on the Internet Use ANCHOR elements Example of an anchor tag: <a href=“http://www.microsoft.com” target=“_blank”>Microsoft</a> The word Microsoft is displayed in the Web page and hyperlinked to the Microsoft Web site The attribute “target” has been added The “target=“ _blank” ” attribute tells the browser to open the Microsoft Web page in a new window
Adding Visual Cues to Hyperlinks Help a viewer to keep track of which hyperlinks have already been visited Use an attribute within the body tag Three examples: <body link=“#0000FF”> sets the color of unvisited links to blue <body vlink=“#00FF00”> sets the color of visited links to green <body alink=“#FF0000”> sets the color of active links to red These can be combined into one statement within the body tag: <body link=“#0000FF” vlink=“#00FF00” alink=“#FF0000”>
Adding Sound Files Can add valuable content or extra interest to the Web page Similar to adding an image May not play in all browsers Overuse can be annoying Should be appropriate for the site Allow the viewer to control it
Adding Sound Files Uses an embed tag Here is an example: <embed name="Heirloom" src="C:\Documents and Settings\Owner.FAMILYROOM\My Documents\My Music\Heirloom.mp3" width=“300” height=“30” loop="false" autostart="false"></embed> Plays the sound file “Heirloom” located on the computer The viewer sees an audio player 300 pixels wide and 30 pixels high When the “loop” attribute is set to “false” the file plays one time When “autostart” is set to “false” the viewer must start the player to hear the file
Lesson Review Explain how to write the XHTML code for each of the following situations: Adding an image to a Web page Inserting a hyperlink to a Web page Adding a sound to a Web page
Practice: Make the following changes to your “Tags and Attributes” Web page: Add an image of your choice Create a hyperlink to your school Web site Add a sound file