tailieunhanh - Learning Web Design Third Edition- P12

Learning Web Design Third Edition- P12:Everything you need to know to create professional web sites is right here. Learning Web Design starts from the beginning defining how the Web and web pages work and builds from there. By the end of the book, you'll have the skills to create multi-column CSS layouts with optimized graphic files, and you'll know how to get your pages up on the Web. | The href Attribute WARNING One word of caution if you choose to change your link colors it is recommended that you keep them consistent throughout your site so as not to confuse your users. Figure 6-1. When a user clicks on the linked text or image the page you specify in the anchor element loads in the browser window. The href Attribute You ll need to tell the browser which document to link to right The href hypertext reference attribute provides the address of the page its URL to the browser. The URL must always appear in quotation marks. Most of the time you ll point to other X HTML documents however you can also point to other web resources such as images audio and video files. Because there s not much to slapping anchor tags around some content the real trick to linking comes in getting the URL correct. TERMINOLOGY URL vs. URI The W3C and the development community are moving away from the term URL Uniform Resource Locator toward the more generic and technically accurate URI Uniform Resource Identifier . At this point URL has crossed over into the mainstream vocabulary. Because it is more familiar I will be sticking with it throughout the discussions in this chapter. If you like to geek out on this kind of thing I refer you to the documentation that defines URIs and their subset URLs protocols uri rfc . There are two ways to specify the URL Absolute URLs provide the full URL for the document including the protocol http the domain name and the pathname as necessary. You need to use an absolute URL when pointing to a document out on the Web. Example href http Sometimes when the page you re linking to has a long URL pathname the link can end up looking pretty confusing Figure 6-2 . Just keep in mind that the structure is still a simple container element with one attribute. Don t let the pathname intimidate you. Relative URLs describe the pathname to the linked file relative to the current document. It doesn t require the .