HTML and CSS Reference
In-Depth Information
As noted in the “Setting Your Home Base” section, earlier in this chapter, your relative position
could be set to some location other than the one where the i le itself is located. For example,
consider the following two Web pages (
Earth.html
and
Alien.html
in this chapter's folder
at
www.wiley.com/go/smashinghtml5
). h e i rst calls the second on a dif erent server;
however, because the i rst page's base is set to the second server, the call is a relative one. h e i rst
i le is named
Earth.html
and is located in the domain
smashingHTML5.com
in the
smashing
folder. However, its base is set to
smashingHTML5.net
in the
smashing
folder.
So, it can use a relative URL to access the i le
Alien.html
on a wholly dif erent server.
Base Set to a Different Server
<!
DOCTYPE HTML
>
<
html
>
<
head
>
<
base href
=
”http://www.smashingHTML5.net/html5/smashing/”
>
<
meta http
-
equiv
=
”Content-Type”
content
=
”text/html; charset=UTF-8”
>
<
title
>
Earth
</
title
>
</
head
>
<
body
>
<
h1
>
This is Earth
</
h1
>
<
a href
=
”Alien.html”
>
Blast off
!</
a
>
</
body
>
</
html
>
106
Web Page on a Different Server
<!
DOCTYPE HTML
>
<
html
>
<
head
>
<
meta http
-
equiv
=
”Content-Type”
content
=
”text/html; charset=UTF-8”
>
<
title
>
The Planet Smashing
</
title
>
</
head
>
<
body
>
<
h1
>
Page from an Alien Server
</
h1
>
</
body
>
</
html
>
Even though the domain for the i rst page (
Earth.html
) is
smashingHTML5.com
, the
base is set to
smashingHTML5.net
. As a result, a relative link to
Alien.html
, which
resides on
smashingHTML5.net
, is made without having to use an absolute address.
TAKE THE WHEEL
In the i rst section of this chapter, you saw how to use the
Refresh
state to automatically
change pages. To have a little fun with animation and the
Refresh
state, take a look at this
link to the works of Eadweard Muybridge: