Bootstrap tabs
by Ondrej
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<script src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container py-5">
<!-- For demo purpose -->
<div class="row mb-5">
<div class="col-lg-8 text-white py-4 text-center mx-auto">
<h1 class="display-4">Bootstrap 4 tabs</h1>
<p class="lead mb-0">Build a few custom styled tab variants using Bootstrap 4.</p>
<p class="lead">Snippet by <a href="https://bootstrapious.com/snippets" class="text-white">
Bootstrapious</a>
</p>
</div>
</div>
<!-- End -->
<div class="p-5 bg-white rounded shadow mb-5">
<!-- Rounded tabs -->
<ul id="myTab" role="tablist" class="nav nav-tabs nav-pills flex-column flex-sm-row text-center bg-light border-0 rounded-nav">
<li class="nav-item flex-sm-fill">
<a id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true" class="nav-link border-0 text-uppercase font-weight-bold active">Home</a>
</li>
<li class="nav-item flex-sm-fill">
<a id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false" class="nav-link border-0 text-uppercase font-weight-bold">Profile</a>
</li>
<li class="nav-item flex-sm-fill">
<a id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false" class="nav-link border-0 text-uppercase font-weight-bold">Contact</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div id="home" role="tabpanel" aria-labelledby="home-tab" class="tab-pane fade px-4 py-5 show active">
<p...
CSS
/*
*
* ==========================================
* CUSTOM UTIL CLASSES
* ==========================================
*
*/
/* Rounded tabs */
@media (min-width: 576px) {
.rounded-nav {
border-radius: 50rem !important;
}
}
@media (min-width: 576px) {
.rounded-nav .nav-link {
border-radius: 50rem !important;
}
}
/* With arrow tabs */
.with-arrow .nav-link.active {
position: relative;
}
.with-arrow .nav-link.active::after {
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #2b90d9;
position: absolute;
bottom: -6px;
left: 50%;
transform: translateX(-50%);
display: block;
}
/* lined tabs */
.lined .nav-link {
border: none;
border-bottom: 3px solid transparent;
}
.lined .nav-link:hover {
border: none;
border-bottom: 3px solid transparent;
}
.lined .nav-link.active {
background: none;
color: #555;
border-color: #2b90d9;
}
/*
*
* ==========================================
* FOR DEMO PURPOSE
* ==========================================
*
*/
body {
background: #304352;
background: -webkit-linear-gradient(to right, #304352, #d7d2cc);
background: linear-gradient(to right, #304352, #d7d2cc);
min-height: 100vh;
}
.nav-pills .nav-link {
color: #555;
}
.text-uppercase {
letter-spacing: 0.1em;
}