Bootstrap 4 navbar appearing vertically not horizontally

前端 未结 4 1033
-上瘾入骨i
-上瘾入骨i 2021-01-11 16:52

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 pr

相关标签:
4条回答
  • 2021-01-11 17:45

    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

    1. Include the bootstrap reference in the project

    1. Now the pagination with bootstrap effect

    0 讨论(0)
  • 2021-01-11 17:45

    Avoid adding classes with single quotations, add classes with double quotations instead.

    0 讨论(0)
  • 2021-01-11 17:48

    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.

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

    0 讨论(0)
  • 2021-01-11 17:59

    Add navbar-toggleable-sm(md/lg) to nav element to make it horizontal till sm, otherwise it would be render vertical every time.

    <nav class="navbar navbar-toggleable-sm navbar-fixed-top navbar-light bg-faded">
    
       ....
    
    </nav>
    

    Demo Plunker

    0 讨论(0)
提交回复
热议问题