I'm working with Bootstrap 4.1.3 and noticed some unexpected padding on the left of all but the first tab in a container.
For demonstration purposes, I set the background of the tab container green, inactive tabs white, borders to blue, and the active tab red. I'm expecting to see zero green - yet, in the example below, you can see it coming through (from the tab container background underneath) on both the second and third tabs.
Example:
I tried using the Chrome Inspector to see if there are extra styles computed (e.g. margin or padding) on the non-first tab elements, but there are none.
Why is this happening?
.tabs {
display: inline-block;
border: 1px solid #ECECEC;
border-radius: 6px;
margin-bottom: 1.85714286em;
background-color: green;
padding: 0;
}
.tabs li:not(.active) {
background-color: #fff !important;
opacity: 1;
}
.tabs li.active {
background-color: red;
}
.tabs > li {
display: inline-block;
opacity: .5;
transition: 0.3s ease;
-webkit-transition: 0.3s ease;
-moz-transition: 0.3s ease;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.tabs > .active,
.tabs:hover {
opacity: 1;
}
.tabs-container.tabs--vertical .tabs li:not(:last-child) {
border-right: none;
border-bottom: 1px solid #ECECEC;
}
.tabs li {
transition: 0.3s ease;
-webkit-transition: 0.3s ease;
-moz-transition: 0.3s ease;
padding: 0.92857143em 1.85714286em;
}
.tabs li:not(:last-child) {
border-right: 1px solid blue;
}
<!--
Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="container">
<div class="row">
<div class="col-md-10">
<div class="tabs-container" data-content-align="left">
<ul class="tabs">
<li>
<div class="tab__title">
<span class="h5">Code Quality</span>
</div>
</li>
<li class="active">
<div class="tab__title">
<span class="h5">Visual Design</span>
</div>
</li>
<li>
<div class="tab__title">
<span class="h5">Stack Experience</span>
</div>
</li>
</ul>
</div>
<!--end of tabs container-->
</div>
</div>
</div>