Css Bootstrap 4 - how to have vertical tabs on wider screens and horizontal on smaller -


i trying make tabs vertical on wider screens , horizontal on smaller screens, not sure how can achieve that. have tried adding flex-md-column , flex-lg-column nav tabs:

<ul class="nav nav-tabs flex-md-column flex-lg-column" id="mytab" role="tablist">   <li class="nav-item">     <a class="nav-link active" id="info-tab" data-toggle="tab" href="#info" role="tab" aria-controls="info" aria-expanded="true"><i class="ion-compose"></i> info</a>   </li>   <li class="nav-item">     <a class="nav-link" id="stats-tab" data-toggle="tab" href="#stats" role="tab" aria-controls="stats"><i class="ion-arrow-graph-up-right"></i> statistics</a>   </li>   <li class="nav-item">     <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact"><i class="ion-email"></i> contact</a>   </li> </ul> 

but, tabs take full width, , tabs content pushed below. how can fix that, tabs take width need, , content can go top, on side of nav-tabs?? have tried setting fixed width nav-items, but, didn't work.

all need combine appropriate flex classes , add little padding here , there. ;)

make sure take closer @ following pages. bootstrap has great documentation page.

flex , spacing

here example:

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css');
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>    <div class="container d-md-flex flex-md-row">    <ul class="nav nav-tabs d-md-inline-flex align-self-md-start flex-md-column" id="mytab" role="tablist">      <li class="nav-item">        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-expanded="true">home</a>      </li>      <li class="nav-item">        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile">profile</a>      </li>    </ul>    <div class="tab-content py-3 px-md-3 py-md-0" id="mytabcontent">      <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">        lorem ipsum dolor sitamet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet. lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet.      </div>      <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">        lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet.      </div>    </div>  </div>


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -