38
Import a New Page and Create an Internal Hyperlink
71
5. Click OK. Save andtest the file in your browser, making sure the ScreenTip
works and that it links back to default.html.
Hyperlink Syntax: Absolute, Relative, and Root-Relative
As you create hyperlinks in Expression Web 4, you will notice that the syntax of the
link address in the Code view changes depending on what you link to. There are
actually three different ways of writing a hyperlink address, all of which are used for
different purposes:
Absolute hyperlinks are complete addresses that contain all the elements of a URL.
They always start with some version of http:// followed by the domain name (for
example, www.designisphilosophy.com) and optionally a page/folder. You use
absolute hyperlinks when linking to pages outside of your current site that have a
different domain name.
Relative hyperlinks are addresses that are relative to the current domain or loca-
tion. They only contain the name of the target page prefixed with any necessary
folder moves (for example, default.html). The browser sees that this is a relative
hyperlink and adds the domain and folder location of the current page to the begin-
ning of the link to complete it. If you use relative hyperlinks and you want to navi-
gate from a page stored in one folder to a page stored in a different folder, you add
the folder prefixes to the hyperlink. For instance, a relative link from a page in Folder
1 to a page in Folder 2 would be ../Folder 2/page.html, where the ../ tells the browser
you want to go out of the current folder and into a new one. When you create hyper-
links between pages in Expression Web 4, they are always inserted as relative links so
that the application can easily update them if you choose to move files around.
However, if you move the files around on your computer outside of the Expression
Web program, the hyperlinks break.
Root-relative hyperlinks are a subset of relative hyperlinks in which all the links are
assumed to start from the root folder (domain name) of the site. They differ from the
relative hyperlinks in that the address is prefixed by a forward slash (for example,
/default.html). The browser applies only the domain to the beginning of this link.
Root-relative hyperlinks are used in place of relative ones in large sites where there is
a chance the files will be moved around without using an application such as
Expression Web 4 to update them. Because they refer to the root of the site rather
than the current location of the page they are placed in, they work regardless of
where the file is placed as longas they remain under the right domain.
▲
www.it-ebooks.info