如何将 bootstrap vue 中的导航栏固定在中间?

How do I fix my navbar in bootstrap vue to be in centre?

如何将导航栏组件放在中间?这是我第一次这样做,大部分都还好,但我似乎无法解决这个问题,所以它看起来并不奇怪

<template>
  <div class="container">
    <header>
      <h1>GIF'S APP</h1>
      <form>
        <span class="font-semibold mr-2 text-left flex-auto text-white">Search for the coolest gifs</span>
        <div>
          <b-nav-form>
            <b-input-group>
              <b-form-input id="input-small" size="sm" type="text" v-model="search" />
              <b-button class="btn-success" type="button" v-on:click="searchNewGifs()">Search</b-button>
              <div class="gifs--container">
                <Gif v-for="gif in gifs" v-bind:key="gif.id" v-bind:data="gif"></Gif>
              </div>
              <b-button
                class="btn-success"
                type="button"
                v-if="!stopNextPage"
                v-on:click="getNextPage()"
              >Next Page</b-button>
            </b-input-group>
          </b-nav-form>
        </div>
      </form>
    </header>
  </div>
</template>

使用 class mx-auto 水平居中,class my-auto 垂直居中,如果你想水平和垂直居中,使用 m-auto 和注意:非常重要的是父级具有样式 dispaly: flex 并且可用的 class 是 d-flex.