How to make a full-width tab card in bootstrap-vue

2019-07-27 04:46发布

I'm having some thing like this from the Docs in bootstrap-vue:

Card with tabs:

enter image description here

So how do I manage to design the tabs like this:

enter image description here

My current code:

  <b-card no-body>
    <b-tabs card>
      <b-tab title="Tab 1" active>
        Tab Contents 1
      </b-tab>
      <b-tab title="Tab 2">
        Tab Contents 2
      </b-tab>
    </b-tabs>
  </b-card>

2条回答
趁早两清
2楼-- · 2019-07-27 05:05

You could add the following simple CSS rules and add full-width class to b-card:

       <b-card no-body class="full-width" >
        ...   

      .full-width .card-header-tabs {
       margin-right: -21px;
       margin-left: -21px;
    }

   .full-width .nav-tabs .nav-item {
       margin-bottom: -1px;
       flex-grow: 1;
       text-align: center;
   }

and everything will be done

check this codesandbox code

查看更多
狗以群分
3楼-- · 2019-07-27 05:12

You can use title-item-class="w-50" to make each tap title occupies 50% width

<b-card no-body>
  <b-tabs card>
    <b-tab title="Tab 1" active title-item-class="w-50">
      Tab Contents 1
    </b-tab>
    <b-tab title="Tab 2" title-item-class="w-50">
      Tab Contents 2
    </b-tab>
  </b-tabs>
</b-card>
查看更多
登录 后发表回答