JSFiddle - React, Tailwind, and code Playground
by Denis Tverdokhlebov
HTML
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="container">
<div class="row">
<div class="col-md-12 tabs_a_us_v3">
<div class="tabs">
<ul class="col-md-12 no_padd_full tabs__caption">
<li class="col-md-3 active">Первая вкладка</li>
<li class="col-md-3">Вторая вкладка</li>
<li class="col-md-3">Третья вкладка</li>
<li class="col-md-3">Червертая вкладка</li>
</ul>
<p class="aus_txt_h_people">Сотрудники подразделения</p>
<div class="col-md-12 tabs__content active">
<p>1</p>
</div>
<div class="col-md-12 tabs__content">
<p>2</p>
</div>
<div class="col-md-12 tabs__content">
<p>3</p>
</div>
<div class="col-md-12 tabs__content">
<p>4</p>
</div>
</div>
</div>
</div>
</div>
CSS
.tabs_a_us_v3 p.aus_txt_h_people {
text-align: center;
font-size: 18px;
padding: 60px 0 45px 0;
}
.no_padd_full {
padding: 0 !important;
}
.tabs_a_us_v3 a {
color: #0094D6;
}
.tabs_a_us_v3 a:hover {
text-decoration: none;
}
.tabs_a_us_v3 p {
padding: 7px 0;
}
.tabs_a_us_v3 h1 {
font-size: 21px;
font-weight: normal;
margin: 0 0 30px;
}
.tabs_a_us_v3 h2 {
font-size: 16px;
font-weight: normal;
margin: 0 0 25px;
}
.tabs_a_us_v3 body {
background: #F6F6F6;
}
.tabs_a_us_v3 .text {
max-width: 700px;
margin: 0 0 30px;
background: #FFF;
border: 2px solid #7DCA86;
border-radius: 5px;
padding: 7px 15px;
box-sizing: border-box;
}
.tabs_a_us_v3 .tabs {
max-width: 100%;
margin: 0 0 30px;
}
.tabs_a_us_v3 .tabs__caption {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
list-style: none;
position: relative;
margin: -1px 0 0 -1px;
}
/* .tabs_a_us_v3 .tabs__caption li:last-child:before {
content: '';
position: absolute;
bottom: -5px;
left: 0;
right: -2px;
z-index: -1;
height: 5px;
background: #7DCA86;
} */
/* .tabs_a_us_v3 .tabs__caption:after {
content: '';
display: table;
clear: both;
} */
.tabs_a_us_v3 .tabs__caption li {
/* padding: 9px 15px;
margin: 1px 0 0 1px; */
background: #61AF6A;
color: #FFF;
position: relative;
border: solid #61AF6A;
border-width: 2px 2px 0;
border-radius: 5px 5px 0 0;
text-align: center;
}
.tabs_a_us_v3 .tabs__caption li:not(.active) {
cursor: pointer;
}
.tabs_a_us_v3 .tabs__caption li:not(.active):hover {
background: #7DCA86;
border-color: #7DCA86;
}
.tabs_a_us_v3 .tabs__caption .active {
background: #FFF;
color: #000;
border-color: #7DCA86;
}
/* .tabs_a_us_v3 .tabs__caption .active:after {
content: '';
position: absolute;
bottom: -5px;
left: 0;
right: 0;
height: 5px;
background: #FFF;
} */
.tabs_a_us_v3 .tabs__content {
...
JavaScript
(function($) {
$(function() {
$('ul.tabs__caption').on('click', 'li:not(.active)', function() {
$(this)
.addClass('active').siblings().removeClass('active')
.closest('div.tabs').find('div.tabs__content').removeClass('active').eq($(this).index()).addClass('active');
});
});
})(jQuery);