Question:
Can someone with experience in website building help me?
?
2011-04-20 17:45:22 UTC
I hav a website but i can only get the homepage up (index.html) but i need to add an a href to my website. the file with the other page i need to link is 2.html do i need to name it something else? or if my websites name is example.com would my a href be example.com/html.2? or example.com/2? help and ps. i did try linking it to my file location but that didnt do anything.
Four answers:
steelstr45
2011-04-20 17:53:24 UTC
When you are writing a link to an internal page on your site, you only need to have the path to the page you want to load.



So for example, if you uploaded:



index.html

2.html



both to the same directory like that, your href would be:



link text



when your site "example.com" loads, it most likely default loads to "example.com/index.html"



You simply need to make your href point to another file. HTML will know you're already on example.com
Bob
2011-04-20 17:50:57 UTC
Your attribute, href, can be specified two different ways. You demonstrated an absolute path.

This is absolute



However, if your 2.html is in the same folder as index.html you can simply refer to it as:

Your other page



This is known as a relative path ;)



EDIT: Also, you must always specify the extension unless your using some sort of server side code (which I doubt). So if your using an absolute path and your file has the extension html then you could link to it

Like This



Make sure your have the proper extension. If, for example, you have 2.htm and you refer to it as 2.html it will not work.
Fear not
2011-04-20 17:52:19 UTC
When you transfer the website files to the internet, they are usually in the same folder (and should be), so you only need the . When the files are in the same folder, they don't need specific URL identifiers.
?
2011-04-20 17:51:12 UTC
Well depends if its in the same root folder, if it is you can just write 2.html

Otherwise you would have to write the whole link.

So did you try

?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...