How to make a full-width tab card in Bootstrap-Vue?

拜拜、爱过 提交于 2019-12-14 03:59:15

问题


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

Card with tabs:

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

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>

回答1:


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




回答2:


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>


来源:https://stackoverflow.com/questions/53217049/how-to-make-a-full-width-tab-card-in-bootstrap-vue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!