<!DOCTYPE html> <html lang="en"> <head> <title> </title> </head> <body> </body> </html>
Anchor (link): <a> </a>
In order to create a link to another html file, surround the
text that acts as a link with an anchor tag. The opening
tag <a> includes
a href attribute. href
(hypertext reference) attribute is used to specify the link
destination
A link to a file in the same directory/folder as the current html file:
<a href="./second.html"> Go to another page </a>
Pathnames indicate where the file is located in the filesystem. There are two ways to specify a file.
Navigating the file system hierarchy relative to the current file.
". " means the current folder ".." means the folder directly above the current "/" represents a delimiting character href="./second.html" <!-- located in the current directory --> href="../above.html" <!-- located in the directory one above (parent) --> href="../../beyond.html" <!-- located two directories above (parent of parent) --> href="./collection/file.html" <!-- located inside the directory "collection" in the current directory -->
Specifying the file based on their absolute location on the file system starting from the top. "Top" can be different depending on your system and how you are accessing your file.
href="http://people.reed.edu/~miyos/F24/ILCP/ilcp_schedule_f24.html" href="https://en.wikipedia.org/wiki/Hyperlink"
Avoid using spaces in pathnames/filenames. There are ways to get around the problem but it is tedious. Use "-" or "_" instead.
Assume case sensitive pathnames. Generally, all lower-case is recommended.
<a href="./c.html"> file C </a> // a link to c.html
<a href="http://people.reed.edu/myproject/c.html"> file C </a> // a link to c.html
You use URLs when specifying the link and also when you browse. An URL specifies the how and the where with the following syntax:
protocol://hostname/pathname
protocol -- the protocol being used. http, https, sftp...etc hostname -- www.reed.edu, www.amazon.com...etc pathname -- the location of the file
http://www.reed.edu/index.html http://www.nytimes.com/pages/arts/index.html http://www.nytimes.com/2012/06/08/arts/design/caravaggio-denial-of-st-peter-met-museum-of-art.html http://mycomputer.reed.edu/portfolio.html // you can run a server on your own computer https://www.amazon.com/gp/yourstore/ // uses https protocol ftp://ftp.freebsd.org/pub/FreeBSD/ // uses ftp protocol file:///Users/miyos/Desktop/file.txt // Note that there are three slashes (hostname is empty) mailto://miyos@reed.edu
id="Campus"So you can do this to jump directly into the Campus section of the page
<a id="ch2"></a>
To create a link within the same document, use the id name with a hashtag (#) in the href attribute
<a href="#ch2">click here</a>
To create a link to an anchor in another document, add the id name with the hashtag after the file name
<a href="B.html#ch2">click here</a>