How to square the sides of top-border?

218 views Asked by At

Is this possible to square (straighten) the top border, as displayed in the picture below?

.nav.nav-tabs.custom-nav-tabs .nav-link {
    border-radius: 0px;
}

.nav.nav-tabs.custom-nav-tabs .nav-link.active {
    border-top: 2px solid green;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

<br/>

<ul class="nav nav-tabs custom-nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" href="#activeAds" data-toggle="tab">Active Ads</a>
    <input type="hidden" class="tab-name" value="active ads">
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#inactiveAds" data-toggle="tab">Inactive Ads</a>
    <input type="hidden" class="tab-name" value="inactive ads">
  </li>
</ul>

1

There are 1 answers

0
Paulie_D On BEST ANSWER

Borders always meet at an angle so if you have other borders the "diagonal" cannot be removed.

However, you can substitute a box-shadow like so.

enter image description here

.nav.nav-tabs.custom-nav-tabs .nav-link {
  border-radius: 0px;
}

.nav.nav-tabs.custom-nav-tabs .nav-link.active {
  border-top: 0px;
  box-shadow: 0 -2px 0 0 green;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<br/>

<ul class="nav nav-tabs custom-nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" href="#activeAds" data-toggle="tab">Active Ads</a>
    <input type="hidden" class="tab-name" value="active ads">
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#inactiveAds" data-toggle="tab">Inactive Ads</a>
    <input type="hidden" class="tab-name" value="inactive ads">
  </li>
</ul>