04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

absolute paths to your files<br />

What’s an Absolute Path?<br />

The last time we talked about paths we were writing <strong>HTML</strong> to make links <strong>with</strong><br />

the element. The path we’re going to look at now is the absolute path part<br />

of a URL, the last part that comes after the protocol (http) and the Web site<br />

name (www.starbuzzcoffee.com).<br />

An absolute path tells the server how to get from your root folder to a particular<br />

page or file. Take Earl’s Autos site, for example. Say you want to look in Earl’s<br />

inventory to see if your new Mini Cooper has come in. To do that, you’ll need<br />

to figure out the absolute path to the file “inventory.html” that is in the “new”<br />

folder. All you have to do is trace through the folders, starting at the root, to get<br />

to the “new” folder where his “inventory.html” file is located. The path is made<br />

up of all the folders you go through to get there.<br />

So, that looks like root (we represent root <strong>with</strong> a “/”), “cars”, “new”, and finally,<br />

the file itself, “inventory.html”. Here’s how you put that all together:<br />

138 Chapter 4<br />

Add on each folder<br />

as you navigate to<br />

the file.<br />

In between the folder<br />

names, put a “/” to<br />

keep them separate.<br />

Absolute path to<br />

“inventory.html”.<br />

Always start<br />

at the root.<br />

new<br />

/<br />

And then add on<br />

the filename.<br />

/<br />

cars<br />

“/”<br />

earls_autos<br />

cars<br />

<br />

.<br />

.<br />

.<br />

<br />

new used<br />

inventory.html<br />

inventory.html<br />

/cars/new/inventory.html<br />

Earl’s Autos<br />

root folder.<br />

<br />

.<br />

.<br />

.<br />

<br />

inventory.html

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!