htmlwebhyperlinknavbar

How do I create links in navbar?


I am in the process of creating my first ever website for my programming course this year and it will be put on the internet. I have kind of the home page and I have the navbar there. Now, let's say I have "contact us" in the navbar and after clicking on it, I want the "contact us" page to open. WHERE do I write the code fot the "contact us" page? Do I make a new .html file, copy some of the code from the original page and change what I want for the "contact us"?? And in what form do I write the link for the "contact us" page on the original page?

<li><a href="#">KONTAKTUJTE NÁS</a></li>

I looked at other websites on the net and its always URL of the original page and then /contact-us. But, just...how? I will be thankful for every answer.

I know I am gonna sound really dumb right now and believe me, I searched the internet for hours but I don't really know how to formulate my question (English isn't my motherlanguage, so that's probabably part of the problem, too). I always get the "put there with the hyperlink". But like the page is not on the internet yet and I just don't know where to write the code.


Solution

  • Thats basic HTML. Let's say index.html is your landing page and you'd like to go to contact.html.

    your index.html file would be:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>index</title>
    </head>
    <body>
        <a href="./contact.html">contact</a>
    </body>
    </html>
    

    contact.html:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>contact</title>
    </head>
    <body>
        <h2>Contact</h2>
    </body>
    </html>
    

    Now you can open the index.html file in a browser and click on the link. The contact.html will open.

    You might wanna read some articles about basic html:

    W3Schools HTML

    W3Schools HTML Links