Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 4 navbar appearing vertically not horizontally

Tags:

bootstrap-4

I have built a Navbar exactly how it has been done on a tutorial yet somehow my navbar appears vertically when it should appear horizontally. Any ideas on how to fix this problem? Thanks in advance

<nav class="navbar navbar-fixed-top navbar-light bg-faded">
    <div class='container'>
        <ul class="nav navbar-nav">
            <li class='nav-item'>
                <a class='nav-link' routerLink="/home" routerLinkActive="active">Home</a>
            </li>
            <li class='nav-item'>
                <a class='nav-link' routerLink="/documents" routerLinkActive="active">Docs</a>
            </li>
            <li class="nav-item dropdown">
                <div ngbDropdown class="d-inline-block dropdown-links">
                    <button class="btn btn-outline-primary" id="proposalDropdown" ngbDropdownToggle>
                        Proposals
                    </button>
                    <div class="dropdown-menu" aria-labelledby="proposalDropdown">
                        <a class="dropdown-item" routerLink="/proposals" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true}">Proposals</a>
                        <a class="dropdown-item" routerLink="/proposals/new" routerLinkActive="active">New Proposal</a>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</nav>
like image 965
Carl Warburton Avatar asked Jan 18 '17 03:01

Carl Warburton


People also ask

Why is my navbar not horizontal?

You need to add display: inline; to the li elements to make them go horizontal. Save this answer.

How do I show the navbar vertically in bootstrap?

The basic vertical menu in bootstrap is only based on . nav class. In the <ul> tag, class “nav navbar-nav” helps to make menu bar vertical. Explanation: The Default vertical menu in bootstrap takes space otherwise we need to use collapse class.

What is inverted navigation bar in bootstrap?

Complete HTML/CSS Course 2022To create an inverted navbar with a black background and with white text, simply add the . navbar-inverse class to the . navbar class.

How do I get the navbar on the right side?

ml-auto class in Bootstrap can be used to align navbar items to the right. The . ml-auto class automatically aligns elements to the right.


2 Answers

Bootstrap 4 requires you add navbar-expand-md to your opening nav classes otherwise it will be vertical ..

<nav class="navbar navbar-fixed-top navbar-expand-md navbar-light bg-faded">

You can replace the md with xs, lg or sm for different breakpoints.

enter image description here

Go to Bootstrap 4 Navbar documentation and view the first example.

like image 53
Inyoka Avatar answered Oct 02 '22 19:10

Inyoka


First thing to check is to refer the bootstrap in the css

This example is for an application in Angular

  1. Without bootstrap included the pagination looked as below

enter image description here

  1. Include the bootstrap reference in the project

enter image description here

  1. Now the pagination with bootstrap effect

enter image description here

like image 43
psuneel127 Avatar answered Oct 02 '22 19:10

psuneel127