Danh mục

giáo trình HTML5 và CSS3 từng bước phần 3

Số trang: 45      Loại file: pdf      Dung lượng: 1.60 MB      Lượt xem: 11      Lượt tải: 0    
10.10.2023

Hỗ trợ phí lưu trữ khi tải xuống: 6,000 VND Tải xuống file đầy đủ (45 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu giáo trình html5 và css3 từng bước phần 3, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
giáo trình HTML5 và CSS3 từng bước phần 368 Chapter 5 Practice Files Before you can use the practice files provided for this chapter, you need to download and install them from the book’s companion content location. See “Using the Practice Files” at the beginning of this book for more information.Hyperlinking to a Web Page No matter what type of hyperlink you want to create, the basic syntax is the same . It starts with the tag, and then uses an href= attribute which provides the URL or the path to the destination . For example, an opening tag might look like this: This is followed by the text that will appear underlined as the link text that you click, or by a reference to the image that will serve as a hyperlink . (You’ll learn more about images in Chapter 9, “Displaying Graphics .”) After that text is the closing tag . Here’s a com- plete example: Visit Microsoft.com for the latest information. When viewed in a browser, this produces a text-based hyperlink similar to that shown in the following image: Hyperlinks are underlined by default . You can specify alternative formatting for hyper- links by using styles, as explained in Chapter 6, “Introduction to Style Sheets .” Using Partial Paths and Filenames In some cases, you do not need to provide a file name or a complete path to the destina- tion in a hyperlink . It depends on the context and the file’s name . If you do not link to a specific page, the server that hosts the Web site responds by displaying the default page for that site (if one is available) . If a browser does not request a specific page when accessing a server, most servers will send the default page, which is usually named either index or default . Perhaps you wondered why the main page of The Garden Company’s Web site is called index.htm—now you know . In Internet Explorer, type the following URL in the Address bar: http://www.microsoft.com/en/us 69 Hyperlinking to a Web PageThe opening page of the US version of the Microsoft Web site opens . Now type this URLinstead:http://www.microsoft.com/en/us/default.aspxThe same page loads . The first time, when you omitted the file name, the Web serverresponded by sending the default file, which is named default.aspx .Note The URL in this example points to a page named default.aspx. ASP stands for ActiveServer Pages, which is an advanced technology used for commercial Web development. Pagescreated with ASP typically have .asp or .aspx extensions. For your own pages, you shouldcontinue to use the .htm extension.If you want to link to a specific page, you must specify the complete file name . Forexample, if you wanted to provide a direct link to the page where users can downloadWindows Media Player, you would use this tag:Download Windows Media PlayerUsing Relative and Absolute PathsPaths that contain a complete address that anyone can use to get to that page are calledabsolute paths . Absolute paths are very reliable, but they are also long and awkward totype . For example:Diagnosing FoliageProblemsWhen you are linking to files in the same Web site as the link itself, you do not need toinclude the complete path to the file; you can simply provide its name . When the fileis in the same folder, you need only supply the file name . For example, if the index.htmand foliage.htm pages of The Garden Company Web site were in the same folder, in theindex.htm file, you could refer to foliage.htm like this:Diagnosing Foliage ProblemsThis is called a relative path, because the destination file is relative to the current file’slocation . Relative paths make it easier to develop and test your Web site in a differentfile location than the one where it will eventually be stored . For example, in this book,you’ll be doing most of your development in the DocumentsMicrosoft PressHTML5 SBSfolder, which would typically not be the final destination for a site you are developing . Bymaking as many relative references as possible, you avoid the need to re-code every URLwhen your site is moved to its final destination .70 Chapter 5 When creating a link to a file that’s stored in a subfolder of the current one, you can point to that subfolder but otherwise leave the path relative . For example, suppose that index.htm is stored in a folder called c:main, and foliage.htm is stored in c:mainarticles, which would be considered a subfolder (or child ...

Tài liệu được xem nhiều: