如何将我的导航栏组件放在中心?这是我第一次这样做,大部分都还好,但我似乎无法解决这个问题,所以它看起来并不奇怪
<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
并且可用的类是 d-flex
。
关于vue.js - 如何将 bootstrap vue 中的导航栏修复为居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60819623/