Jump to content

question from a newbie about NAV tag


Amazin

Recommended Posts

<nav> <a href="/html/">HTML</a> | <a href="/css/">CSS</a> | <a href="/js/">JavaScript</a> | <a href="/jquery/">jQuery</a></nav>
in the above example, <a> tag is used. The content inside the <a> tag is name of the file and whatever is in between the tags is name of the link that will appear on the website. have I got it correct?
In another word, If I want to create a another web page called "page2", I will first need to create a new file on my notepad and I can name it whatever I want (lets call it red2) and once all the coding are done, I can do:
<a href="red2/">page2</a>
so if you click on "page2" it will direct you there. is that correct?
Link to comment
Share on other sites

You need to put a .html or .htm extension on your file. If you save the file as red2.html you can access the file using <a href="red2.html">Page 2</a>

The content between the tags is what's visible.

 

You should read the tutorial page: http://www.w3schools.com/html/html_links.asp

Link to comment
Share on other sites

@Amazin

 

You're not necessarily wrong with what you said, you're just not complete. Keep up with me here, if you were to have a folder named "myProject", and a file in there that was the homepage of your website "index.html". Within your index.html you had a link to another html file named "Contact_Us.html" that is also inside of "myProject", and you wanted to put that into your navigational bar(<nav>). This is how you would do it:

<!DOCTYPE html> <!-- Declaring that this page is running on HTML5. --><html>	<head>		<title>Home page</title>		<meta charset="UTF-8">	</head>	<header>		<nav> <!-- New feature with HTML5, instead of using a 'div'. -->			<a href="Contact_Us.html">Displayed Text</a> <!-- Links it to the Contact_Us page.-->		</nav>	</header>	<body>		<!--Where the main bit of your page goes, blank for this example.-->	</body></html>

With that said, I hope I helped. If you want to know more keep reading.

Okay, now if you have a folder("Forums") within your folder("myProject"), and want to link your home page("index.html") with a file called "Forums.html" inside of "Forums", you would make the link this instead:

<a href="Forums/Forums.html">Displayed Text</a> <!-- Links it to the Contact_Us page.-->

Keep up now, if you're still following, let's say you have every page into separate folders like I do, you will need to know how to back out of files. To add on to what we already have, let's say you had your home page ("index.html") into a folder named "Home", then this would be your code to get from your page("Forums.html"), to you're page("index.html"):

<a href="../Home/index.html">Displayed Text</a> <!-- You would need to first back out of the file, second open the folder, and then finally call the file to load. -->

I really hope this helped! :)

Edited by Professor GIBS
Link to comment
Share on other sites

Aha, to be honest I didn't know that. I know that it never made a difference, just looked neater to me honestly. Thanks for the information! I'll change it in the post to make it correct. :)

Link to comment
Share on other sites

 

Keep up now, if you're still following, let's say you have every page into separate folders like I do, you will need to know how to back out of files. To add on to what we already have, let's say you had your home page ("index.html") into a folder named "Home", then this would be your code to get from your page("Forums.html"), to you're page("index.html"):

 

thank you so much for your explaination. I have so much to learn so its always good to check to see if I'm on the right track. Is there an easier way to identify the correct link to the file or do we always have to write it out manually? just to clarify, everytime each web page will have its own file right? and it should be saved as .HTML right?

Link to comment
Share on other sites

  • 2 weeks later...

screenshot_zps5f31a2c7.png

 

I don't think so, I'm so confused:(

 

here are the codes I entered for Home.html:

 

 

<HTML><header><link rel="stylesheet" type="text/css" href="mydesign.css"><H1>This is my world</H1><nav><a href="About.html">About</a></nav></header><BODY><ul><li>1</li><li>2</li></ul><a href="http://www.ukbusinessforums.co.uk/forums/general-business-forum.47/" ALIGN="center">business link</a><p>I am learning HTML;p</p><p> hello hello hello</p></BODY></HTML>

 

do you see anything wrong?

Link to comment
Share on other sites

I think even though it shows About.html, if you look at other files you will see for example the css file 'mydesign' that the file extensions are not showing, I conclude that you have 'Hide file extension for known types' enabled within 'Folder and search options' and that you have unknowingly named the file as About.html.html, Elementary my dear Watson. :-)

Link to comment
Share on other sites

I think even though it shows About.html, if you look at other files you will see for example the css file 'mydesign' that the file extensions are not showing, I conclude that you have 'Hide file extension for known types' enabled within 'Folder and search options' and that you have unknowingly named the file as About.html.html, Elementary my dear Watson. :-)

 

I have experienmented with about/about.html but still getting the same problem:( So where do I go and change 'folder and search options'? Thanks for your feedback

Link to comment
Share on other sites

Where your files are located in top left you will see 'Organize' click then 'Folder and search options' -> View tab and look for 'Hide file extension for known types' and uncheck it. as i said when this is done you will probably find the html files in question are named Home.html.html and About.html.html or similar.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...