HTML linking question, relative URLs?

  • Thread starter Thread starter suroki
  • Start date Start date
S

suroki

Guest
I've been poring over my HTML textbook for some time now, and I'm just getting more confused. I know someone out there can help me with these questions! If you could explain them a little too, that would be awesome.

1. If we were building a page inside your "work123" folder and wanted a relative link from it to a page called "index.htm" in your "hw" folder, what would be the HTML code? (Note: This is the folder heirarchy: work123 > hw > index.htm)

2. What would be the code for an anchor named "part1"?

3. What would be the code for a relative URL (or anchor link) to that anchor?
 
I think you're looking for...

1. So if you're in work123/hw/index.htm and you want to link to work123/foo.htm you're looking for the following code:
<a href="../../foo.htm">Go!</a>

the "../" means go one folder up

2. <a name="part1">Here</a>

3. And if you're linking to that anchor (in banana.htm) from a different page, you want

<a href="banana.htm#part1">Hey!</a>

That will send you to banana.htm and scroll to where you put part1 in the markup.

is that what you're looking for?
 
Back
Top