xnok
xnok

Reputation: 339

Navbar links links staying outside of the dropdown menu

I am trying to place my span classes inside my navbar header, however, for some reason, its staying outside the dropdown menu.

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="Main.css" rel="stylesheet" />
    <title>Page Title</title>
</head>

<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-main">
                    <span class="sr-only">TOGGLE NAVIGATION</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
            <div class="collapse navbar-collapse" id="navbar-collapse-main">
                <ul class="nav navbar-nav navbar-right">
                    <li><a class="active" href="#">Home</li>
                    <li><a href="#">About</li>
                    <li><a href="#">Serviços</li>
                    <li><a href="#">Testemunhos</li>
                    <li><a href="#">Contato</li>
                </ul>
            </div>
        </div>
    </nav>
    <div id="home">
        <div class="landing-next">
            <h1>BOOTSTRAP</h1>
            <h3>Building my first webpage.</h3>
            <a href="#" class="btn btn-success">Get Started With a Webpage Today</a>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
        crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
        crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
        crossorigin="anonymous"></script>
</body>




</html>

Also another problem that i noticed is within my div class, for some reason my div landing-next is displaying links inside my tags, i want them to show normal letters.

Upvotes: 2

Views: 42

Answers (1)

David
David

Reputation: 7315

The three span tags to build the so-called hamburger menu is v3 code and it isn't available any longer. From the migration docs:

  • .navbar-toggle is now .navbar-toggler and has different styles and inner markup (no more three <span>s).

There are several alternatives. You can use a vector font (e.g. FontAwesome with fa fa-bars) or, like Bootstrap in some examples, a Data URI for SVG.

Regarding the links, you just forgot to close the <a>tags.

Upvotes: 1

Related Questions