[Solved] Bootstrap not displaying as it should

#1

Hi everyone !

As I was learning meteor, I felt the need to make my app looks a bit more beautiful. So I decided to install bootstrap

 meteor add twbs:bootstrap@3.3.6

Then, I took one of the example navbars on the bootstrap site

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <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="#">Link</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Dropdown
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

I simply put it in a template and then I saw that the navbar I got wasn’t the one I expected.

What I got :

What I expected :

I’m surely missing something here. Any suggestion ?

Thank you for time !

#2

Looks like the CSS is missing.

Personally, I would not use this Atmosphere package for bootstrap, instead I think it’s better to install it directly from NPM. Looks like the Atmosphere package has not been updated since late 2016 and I’m not sure if it’s open source.

I hope that helps!

3 Likes
#3

It worked !

  1. I removed the bootstrap package
    meteor remove twbs:bootstrap
    
  2. I installed bootstrap again and his peer dependencies jquery and popper.js via NPM
    meteor npm install --save jquery popper.js bootstrap
    
  3. I imported bootstrap’s ready-to-use css in my main.js
    import 'bootstrap/dist/css/bootstrap.min.css';
    

Thank you for your help !

4 Likes
#4

Thanks. it’s work for me. and also saved my time.

1 Like