asp.net-corebootstrap-4bootstrap-tabs

ASP.NET MVC Core 3.1 not rendering bootstrap tab properly


I have to implement Tab control in the ASP.NET MVC 3.1 which contains bootstrap 4.3.1. Could you please help me? I have just put the HTML markup as below:

<ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#home">Home</a></li>
    <li><a data-toggle="tab" href="#menu1">Menu 1</a></li>
</ul>

<div class="tab-content">
    <div id="home" class="tab-pane fade in active">
        <h3>HOME</h3>
        <p>Some content.</p>
    </div>
    <div id="menu1" class="tab-pane fade">
        <h3>Menu 1</h3>
        <p>Some content in menu 1.</p>
    </div>
</div>

This is not rendering the tab properly which is something like the screenshot below:
enter image description here

I want to render the tab as show below:
enter image description here


Solution

  • Why don't people reference back to the Bootstrap documentation first to check if they have a valid structure or not?

    demo: https://jsfiddle.net/davidliang2008/sarmvoct/16/


    You can style .tab-content with paddings to create something that matches up your screenshot:

    .tab-content {
        padding: 1rem .25rem;
    }
    

    demo: https://jsfiddle.net/davidliang2008/sarmvoct/20/