1

I made a homepage for my website development class, apparently when I tried to click the link of the navigation menu it won't work. I don't really know what's wrong so I wish you could help me with this. here's my code:

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="lg2.png"><img src="lg2.png" alt="A" style="width:150;height:50px"></a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.html" target="_nextpage">HOME</a></li>
        <li><a href="download.html" target="_nextpage">DOWNLOAD</a></li>
        <li><a href="signup.html" target="_nextpage"><span class="glyphicon glyphicon-user"></span></span> REGISTER</a></li>
      </ul>
    </div>
  </div>
</nav>

and this are the css codes for the navbar:

.navbar {
      margin-bottom: 0;
      background-color: #086A87;
      z-index: 9999;
      border: 0;
      font-size: 12px !important;
      line-height: 1.42857143 !important;
      letter-spacing: 4px;
      border-radius: 0;
      font-family: Montserrat, sans-serif;
  }
  .navbar li a, .navbar .navbar-brand {
      color: #fff !important;
  }
  .navbar .navbar-collapse {
  text-align: center;
}
  .navbar-nav li a:hover, .navbar-nav li.active a {
      color: #f4511e !important;
      background-color: #fff !important;
  }
  .navbar-default .navbar-toggle {
      border-color: transparent;
      color: #fff !important;
  }

could somebody help me please?????

j08691
  • 204,283
  • 31
  • 260
  • 272
  • Have you checked your console for errors and have you included jQuery followed by BootstrapJS? [Docs](https://getbootstrap.com/getting-started/#whats-included) You also have an extra closing span at `REGISTER` – vanburen Feb 24 '16 at 03:46
  • Also, as far as I know `target="_nextpage"` is not valid. See [MDN Elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) and https://stackoverflow.com/questions/18360438/attribute-target-newtab-for-links – vanburen Feb 24 '16 at 06:16

1 Answers1

0

Seems to be working fine here: https://jsfiddle.net/pjhppxkt/ More details as to what you mean by:

apparently when I tried to click the link of the navigation menu it won't work.

is needed. Which link are you pressing? What is the result you expect etc. You also had an extra </span> class which I removed. Shouldn't have affected anything though.

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="lg2.png"><img src="lg2.png" alt="A" style="width:150;height:50px"></a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.html" target="_nextpage">HOME</a></li>
        <li><a href="download.html" target="_nextpage">DOWNLOAD</a></li>
        <li><a href="signup.html" target="_nextpage"><span class="glyphicon glyphicon-user"></span>REGISTER</a></li>
      </ul>
    </div>
  </div>
</nav>

EDIT You need to change:

target="_nextpage"

to:

target="_blank"
Keith Anderson
  • 167
  • 2
  • 13