Bootstrap 4 Navbar link not positioned correctly

Viewed 444

Please see the image for the problem:

enter image description here

As seen above, the NavBar link are all stacked instead of correctly displaying in one row.

Here is my HTML code:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    <!-- build:css(.) styles/vendor.css -->
    <!-- bower:css -->
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
    <!-- endbower -->
    <!-- endbuild -->
    <!-- build:css(.tmp) styles/main.css -->
    <link rel="stylesheet" href="styles/main.css">
    <!-- endbuild -->
  </head>
  <body ng-app="santaApp">
    <!--[if lte IE 8]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->

    <!-- Add your site or application content here -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <a class="navbar-brand" href="#">Navbar</a>
      <ul class="navbar-nav">
          <li class="nav-item active">
            <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Features</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Pricing</a>
          </li>
          <li class="nav-item">
            <a class="nav-link disabled" href="#">Disabled</a>
          </li>
        </ul>
    </nav>

    <div class="container">
      <div ng-view=""></div>
    </div>

    <div class="footer">
      <div class="container">
        <p><span class="glyphicon glyphicon-heart"></span> from the Yeoman team</p>
      </div>
    </div>

    <!-- javascripts here -->
</body>
</html>

I am using yeoman-angular generator out of the box and just modified it to use bootsrap4 and ui-bootstrap4. Also, i am still using Angular 1.x. and those navbar code came right off the bootstrap4 site. i just copied it and inserted it.

Also, all reference files (i.e js, css) has been successfully link, i checked it on the browser.

Anybody has an idea what happen to this?, i ran out of idea since i just ran it out of the box and no other modification was applied except for bootstrap stated above.

UPDATE

As i was hovering over the navbar, i noticed that the whole navbar was clickable, i think the tag was filling the whole navbar.. still i do not understand why it filled the whole navbar row.

UPDATE

Base on the current answer there must be something wrong with my current version of bootstrap. so what i did was i tested another version:

Version: Bootstrap v4.0.0-beta (https://getbootstrap.com) - result is OK.

Version: Bootstrap v4.0.0-alpha.6 (https://getbootstrap.com) - result is NOT OK.

So based on the above result, im going to use v4.0.0-beta.

2 Answers

ul#menu li {
  display:inline;
}
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    <!-- build:css(.) styles/vendor.css -->
    <!-- bower:css -->
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
    <!-- endbower -->
    <!-- endbuild -->
    <!-- build:css(.tmp) styles/main.css -->
    <link rel="stylesheet" href="styles/main.css">
    
    <!-- endbuild -->
  </head>
  <body ng-app="santaApp">
    <!--[if lte IE 8]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->

    <!-- Add your site or application content here -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <a class="navbar-brand" href="#">Navbar</a>
      <ul id="menu" class="navbar-nav">
          <li class="nav-item active">
            <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Features</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Pricing</a>
          </li>
          <li class="nav-item">
            <a class="nav-link disabled" href="#">Disabled</a>
          </li>
        </ul>
    </nav>

    <div class="container">
      <div ng-view=""></div>
    </div>

    <div class="footer">
      <div class="container">
        <p><span class="glyphicon glyphicon-heart"></span> from the Yeoman team</p>
      </div>
    </div>

    <!-- javascripts here -->
</body>
</html>

Look at the css, in order to display inline you will need to use display:inline;

.navbar-collapse.collapse {
  display: block!important;
}

.navbar-nav>li, .navbar-nav {
  float: left !important;
}

.navbar-nav.navbar-right:last-child {
  margin-right: -15px !important;
}

.navbar-right {
  float: right!important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

  <body ng-app="santaApp">
    <!--[if lte IE 8]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->

    <!-- Add your site or application content here -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">Navbar</a>
        </div>
        <ul class="nav navbar-nav">
            <li class="active"><a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a></li>
            <li><a class="nav-link" href="#">Features</a></li>
            <li><a class="nav-link" href="#">Pricing</a></li>
            <li><a class="nav-link disabled" href="#">Disabled</a></li>
        </ul>
      </div>
    </nav>

    <div class="container">
      <div ng-view=""></div>
    </div>

    <div class="footer">
      <div class="container">
        <p><span class="glyphicon glyphicon-heart"></span> from the Yeoman team</p>
      </div>
    </div>
    <!-- javascripts here -->
</body>

Related