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











up vote
1
down vote

favorite












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>









share|improve this question
























  • did you try my answer?
    – Boussadjra Brahim
    Nov 8 at 23:07















up vote
1
down vote

favorite












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>









share|improve this question
























  • did you try my answer?
    – Boussadjra Brahim
    Nov 8 at 23:07













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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>









share|improve this question















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>






javascript css vue.js frameworks bootstrap-vue






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 0:01

























asked Nov 8 at 22:22









quanpham0805

349




349












  • did you try my answer?
    – Boussadjra Brahim
    Nov 8 at 23:07


















  • did you try my answer?
    – Boussadjra Brahim
    Nov 8 at 23:07
















did you try my answer?
– Boussadjra Brahim
Nov 8 at 23:07




did you try my answer?
– Boussadjra Brahim
Nov 8 at 23:07












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










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






share|improve this answer























  • I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
    – quanpham0805
    Nov 8 at 23:25








  • 1




    i'm trying to find a way to make that unique
    – Boussadjra Brahim
    Nov 9 at 0:01






  • 2




    Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
    – nardnob
    Nov 9 at 14:04






  • 1




    @nardnob thanks a lot, i dit that
    – Boussadjra Brahim
    Nov 9 at 14:22






  • 2




    @quanpham0805 i updated my answer with nardnob's suggestion
    – Boussadjra Brahim
    Nov 9 at 14:25


















up vote
2
down vote













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>





share|improve this answer





















  • It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
    – quanpham0805
    Nov 8 at 22:58













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217049%2fhow-to-make-a-full-width-tab-card-in-bootstrap-vue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










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






share|improve this answer























  • I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
    – quanpham0805
    Nov 8 at 23:25








  • 1




    i'm trying to find a way to make that unique
    – Boussadjra Brahim
    Nov 9 at 0:01






  • 2




    Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
    – nardnob
    Nov 9 at 14:04






  • 1




    @nardnob thanks a lot, i dit that
    – Boussadjra Brahim
    Nov 9 at 14:22






  • 2




    @quanpham0805 i updated my answer with nardnob's suggestion
    – Boussadjra Brahim
    Nov 9 at 14:25















up vote
1
down vote



accepted










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






share|improve this answer























  • I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
    – quanpham0805
    Nov 8 at 23:25








  • 1




    i'm trying to find a way to make that unique
    – Boussadjra Brahim
    Nov 9 at 0:01






  • 2




    Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
    – nardnob
    Nov 9 at 14:04






  • 1




    @nardnob thanks a lot, i dit that
    – Boussadjra Brahim
    Nov 9 at 14:22






  • 2




    @quanpham0805 i updated my answer with nardnob's suggestion
    – Boussadjra Brahim
    Nov 9 at 14:25













up vote
1
down vote



accepted







up vote
1
down vote



accepted






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






share|improve this answer














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







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 at 14:21

























answered Nov 8 at 22:40









Boussadjra Brahim

4,2003628




4,2003628












  • I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
    – quanpham0805
    Nov 8 at 23:25








  • 1




    i'm trying to find a way to make that unique
    – Boussadjra Brahim
    Nov 9 at 0:01






  • 2




    Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
    – nardnob
    Nov 9 at 14:04






  • 1




    @nardnob thanks a lot, i dit that
    – Boussadjra Brahim
    Nov 9 at 14:22






  • 2




    @quanpham0805 i updated my answer with nardnob's suggestion
    – Boussadjra Brahim
    Nov 9 at 14:25


















  • I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
    – quanpham0805
    Nov 8 at 23:25








  • 1




    i'm trying to find a way to make that unique
    – Boussadjra Brahim
    Nov 9 at 0:01






  • 2




    Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
    – nardnob
    Nov 9 at 14:04






  • 1




    @nardnob thanks a lot, i dit that
    – Boussadjra Brahim
    Nov 9 at 14:22






  • 2




    @quanpham0805 i updated my answer with nardnob's suggestion
    – Boussadjra Brahim
    Nov 9 at 14:25
















I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
– quanpham0805
Nov 8 at 23:25






I've tried your solution and this is what I got: Result It's cool but it only work with <style> tag instead of <style scoped> tag, which is a little bit hard to understand why. Moreover, is there any way that I could shrink the tabs on top of the card?
– quanpham0805
Nov 8 at 23:25






1




1




i'm trying to find a way to make that unique
– Boussadjra Brahim
Nov 9 at 0:01




i'm trying to find a way to make that unique
– Boussadjra Brahim
Nov 9 at 0:01




2




2




Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
– nardnob
Nov 9 at 14:04




Add a class to your b-card like class="big-card", then prefix your CSS with that class. Like: .big-card .card-header-tabs { ... }. Then the CSS will only apply to card-header-tabs within big-cards
– nardnob
Nov 9 at 14:04




1




1




@nardnob thanks a lot, i dit that
– Boussadjra Brahim
Nov 9 at 14:22




@nardnob thanks a lot, i dit that
– Boussadjra Brahim
Nov 9 at 14:22




2




2




@quanpham0805 i updated my answer with nardnob's suggestion
– Boussadjra Brahim
Nov 9 at 14:25




@quanpham0805 i updated my answer with nardnob's suggestion
– Boussadjra Brahim
Nov 9 at 14:25












up vote
2
down vote













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>





share|improve this answer





















  • It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
    – quanpham0805
    Nov 8 at 22:58

















up vote
2
down vote













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>





share|improve this answer





















  • It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
    – quanpham0805
    Nov 8 at 22:58















up vote
2
down vote










up vote
2
down vote









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>





share|improve this answer












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>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 8 at 22:38









ittus

5,5271723




5,5271723












  • It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
    – quanpham0805
    Nov 8 at 22:58




















  • It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
    – quanpham0805
    Nov 8 at 22:58


















It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
– quanpham0805
Nov 8 at 22:58






It turns out like this: Result Is there any way that I could shrink the tabs on top of the card? Which means that the tabs take full size of the card header?
– quanpham0805
Nov 8 at 22:58




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217049%2fhow-to-make-a-full-width-tab-card-in-bootstrap-vue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Hercules Kyvelos

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud