Ask coding questions

← Back to all posts
How to link websites in navbar?
KennedyHall1 (0)

Hi! I'm using a navbar dropdown template from W3Schools for a school assignment, and I need to link multiple pages. When I make new HTML files and try to copy/paste the link into the "#" sections and then run the program, it just says that Repl.it refused to connect. I'm not sure if I'm doing something wrong or if Repl.it is being buggy. Any help is appreciated!

(I've never posted a question before, so if anything's wrong, please tell me!)

Answered by Bookie0 (5976) [earned 5 cycles]
View Answer
Comments
hotnewtop
Bookie0 (5976)

So I opened the navbar via the 'hamburger' icon, and the only link that works is In-Depth Info which takes me to this repl.

The other links don't work

I think you need to put the name of the file in the href. instead of this:

<li class="nav-item">
        <a class="nav-link" href="#">The Problem</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">The Solution</a>

Do this:

<li class="nav-item">
        <a class="nav-link" href="theproblem.html">The Problem</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="thesolution.html">The Solution</a>

So instead of #, put the name of the file (this goes not only for this example) :D

Is this what you wanted? Lemme know! ;)

KennedyHall1 (0)

@Bookie0 Exactly what I needed, thanks!

Bookie0 (5976)

@KennedyHall1 np! Mark as correct answer (if it helped)? :D

Coder100 (16985)

Oops you need to specify the filename, not the link to your source code!!

      <li class="nav-item">
        <a class="nav-link" href="/information.html">In-Depth Info</a>
      </li>

just like that. Super easy. Did you overthink it?

KennedyHall1 (0)

@Coder100 Yeah, I think I did. Thanks!