Biscuit
Biscuit

Reputation: 13

File path trouble using href. Pages stored in different folders. Brand new to HTML

I'm brand spankin' new to HTML so bear with me a bit.

I am having some trouble linking pages using href.

I have two "sites" I'm trying to link. SiteA and SiteB. I keep the files for each in two separate folders to keep myself organized. They're both in my "Documents" folder, laid out kind of like this.

Folder-A Folder-B
AHome.html BHome.html
APage1.html BPage1.html
APage2.html BPage2.html

Using href, I can link from one page to another in the same folder, right?

Eg. If I'm on AHome, this would create a link for me to get to APage1.

<a href="APage1.html">Link to APage1</a>

But, assuming it's possible with just HTML, how would I create the link from AHome to BHome? I need to go up into "Documents" from "FolderA" and then back down into "FolderB" to reference that BHome.html file.

I'd appreciate any help. It's possible I'm simply not organizing my files in a good way for HTML or there's a way of consolidating pages I don't know yet or something of that nature.

Thanks and Cheers!

Upvotes: 0

Views: 32

Answers (1)

James
James

Reputation: 81

../ will take you up a directory from wherever you are currently, so if you're trying to link for example 'AHome.html' to 'BHome.html' you'd want to try the following:

<a href="../Folder-B/BHome.html">Link to site B</a>

This is taking you out of 'Folder-A', up one directory to "Documents" and then into 'Folder-B'

Upvotes: 2

Related Questions