essentials of html class 3 instructor: jeanne hart [email protected]
Click here to load reader
Post on 25-Dec-2015
Embed Size (px)
- Slide 1
- Essentials of HTML Class 3 Instructor: Jeanne Hart [email protected]
- Slide 2
- Linking Text and Documents In this lesson, you will learn how to use HTML's most valuable feature: hyperlinks.
- Slide 3
- Linking Text and Documents What Is a URL? All Web pages, Internet resources, files, and so on, have an address. That address is known as a Uniform Resource Locator, or URL. Before you can link to another page (or resource), you have to know its address. You can find the URL for any resource in the Address box (or Location box) of your browser.
- Slide 4
- URL cont That address is known as a Uniform Resource Locator, or URL. Before you can link to another page (or resource), you have to know its address. You can find the URL for any resource in the Address box (or Location box) of your browser.
- Slide 5
- Caution Although URL is the commonly accepted term to describe the location of Internet resources, a new term, URI (Uniform Resource Identifier), will likely replace it as HTML 5 becomes the standard.
- Slide 6
- Anchors The tag (called an anchor) is used to define hyperlinks. Unlike most other HTML tags, the tag requires an attribute. When you use the tag, you must specify whether you want the enclosed text to link to someplace (with the tag) or be linked from someplace (with the tag).
- Slide 7
- Hyperlinks The easiest link to learn is the hyperlink to another location. The tag with the HRef attribute and its closing tag,, surround any text that you want to highlight. The default hyperlink highlighting in HTML is underlined blue text.
- Slide 8
- Linking to other Files and Email You can link to more than just other people's Web sites. You can use the same HRef attribute to link to email addresses, or for other pages of your own Web site, or even to other files on your own computer. The hyperlink to point to another file (second.htm) on my own computer, for example, is shown in the following code. In this example, the second.htm file is stored in the same directory as the page linking to it.
- Slide 9
- Linking cont Please click here to open my second Web page. If, however, my second.htm file was stored in another directory (for example, the Links directory), the hyperlink would need to include the directory name too, as in the following: Please click here to open my other page.
- Slide 10
- Tip Did you know that you can force your hyperlink for a pdf document to open a new browser window?
- Slide 11
- Tip cont Use the target="_blank" attribute, as in the following example. Try it! Click here to open a related Web site.
- Slide 12
- Linking to an email You also can link to an email address by using the mailto prefix, as shown in the following code line. When you click on the words click here, an email window that enables you to type your message to Mickey Mouse appears. Click here to send mail to Mickey.
- Slide 13
- Caution The W3C is calling for the use of a new attribute for the tag (called id) to replace the name attribute. The smart thing to do (to make sure that you comply with the new standard when it is released) is to use both attributes in your documents. To avoid problems, use the same value for both attributes, for example, if name="dogs" then id="dogs" as well.
- Slide 14
- Summary In this lesson, you've learned: Anchor tags come with three attributes: HRef (which links to someplace), and name and id (which link from someplace). You can copy the URL of any Web page from your browser and paste it between the quotes of the href attribute in your tag.
- Slide 15
- Using Images/Graphics In this lesson, you'll learn how to add another element to your Web pages with graphics or images.
- Slide 16
- Using Graphics Adding images - If the Web were nothing but text, it would still be technologically impressive, but it wouldn't be nearly as much fun. Adding images to your pages is easy; adding images that make your Web pages look professional just takes a little know- how.
- Slide 17
- Images/Graphics cont The two most frequently used graphics file formats found on the Web are GIF and JPEG. The Joint Photographic Experts Group (JPEG) format is used primarily for realistic, photographic-quality images. The Graphics Interface Format (GIF) is used for almost everything else.
- Slide 18
- Images/Graphics cont One new file format is gaining popularity among designers and will soon be making its presence known: The Portable Network Graphics format (PNG) is expected to replace the GIF format someday. Don't rush out to replace all your graphics, however; not all browsers support it fully yet.
- Slide 19
- Sound like a pro learn how to pronounce the graphic formats you use. GIF is pronounced "jif" (like the peanut butter), JPEG is pronounced "jay-peg," and PNG is pronounced "ping."
- Slide 20
- Images cont You add all images by using a single HTML tag, the image source tag,.
- Slide 21
- The img src tag By now you probably recognize that this tag is actually an tag with an attribute (src) and attribute value (location), but because all images require a src attribute, it's easier to refer to it as a single tag. You'll also notice that the image tag does not have a corresponding closing tag. It is a single tag and you'll need to remember to add the closing slash at the end: and yes there is a space.
- Slide 22
- Images cont First Images This is an image in my first Web page.
- Slide 23
- Alternate Text When browsing the Web, you might have noticed that many times when you move your mouse pointer over an image, you see a text pop-up that describes the image, or tells you something more about the area of the Web site that image represents. This doesnt always work in IE 8 or higher
- Slide 24
- Alt Attribute This sets the alternate text for a graphic. It was named alt because it describes the text some people would see as an alternative to the image that others would see.
- Slide 25
- Alt Attribute cont The alt attribute has another very important purpose. Many people with slower modem connections to the Web decide to customize their browser settings to ignore graphics because loading graphics into a Web browser can sometimes take a long time.
- Slide 26
- Alt tag cont Remember, too, that not all browsers enable you to view graphics. Some browsers, such as Lynx, have no graphics capabilities at all. The alt attribute ensures that people who can't view your graphics can still understand their context.
- Slide 27
- Alt tag cont The following HTML sample shows how the alt attribute is added into the tag. Like the src attribute, the alt attribute tells the browser more information about the image. And, like the src attribute, you should always use the alt attribute with the tag.
- Slide 28
- Caution Although you should use the alt attribute whenever you use the tag, make sure that you don't specify irrelevant text. For example, there is no point in specifying alternate text for a decorative image (such as a bullet or a line); instead, specify an empty value (alt=" ").
- Slide 29
- Images and Browsers The Web browser interprets pixels and percentages equally well when rendering an image. You need to remember, however, that your Web visitors may not use the same monitor display settings that you do. What does this mean to you? My monitor is set to 800 pixels wide.
- Slide 30
- Tip Create the illusion of faster image loading. Regardless of whether you're resizing an image or not, you should always include the height and width attributes because they give the browser important information about how much space will be required to show the image on the page. This way, the browser can set that space aside and continue building other aspects of the page even while the image downloads. This gives the impression that the page loads faster since the viewer doesn't have to wait for the entire image to download before looking at other areas of the page.
- Slide 31
- Aligning Text and Images You can use the align attribute of the tag to force an image to appear on the left or right of a section of text..
- Slide 32
- Aligning cont You also can use the align attribute to vertically align an image with the text. The align attribute has three more values: top, bottom, and center, which are discussed in the following list Setting the align attribute to top aligns the top of the image with the top of any surrounding text. Setting the align attribute to bottom aligns the bottom of the image with the bottom of any surrounding text. Setting the align attribute to center aligns the center of the image with the center of any surrounding text.
- Slide 33
- Caution Be sure to preview your HTML documents in the browser (or in several browsers) to make sure that you are happy with how they look before you publish them. Not all browsers treat these align attributes in the same way.
- Slide 34
- Using Images as Links Images are good for more than just looks. You can use them to provide creative hyperlinks