'CSS tabs with rounded base (smooth base transition) [duplicate]

Hi I am looking for the most efficient way to create a "tab" with HTML/CSS with rounded corners but also a smooth, rounded transition to the base.

Example: enter image description here

I came up with a solution using two elements on both side of the tab having a CSS gradient

.tab  {
  border: none;
  height: 100%;
  width: 300px;
  line-height: 100px;
  text-align: center;
  background-color: #BCC6CC;
  display: inline-block;
  border-bottom-left-radius: 50px;
  border-bottom-right-radius: 50px;
}

.tab-base-right {
  width: 50px;
  height: 50px;
  line-height: 100px;
  display: inline-block;
  background-image: radial-gradient(circle at 100% 100%, rgba(0,0,0,0) 50px,#BCC6CC 50px );
  border: none;
}

see my solution on Codepen

I wonder if there is any better/nicer way to achieve that.



Solution 1:[1]

Use css psuedo elelmts to achieve the same,

ul.rounded-tabs {
  list-style-type: none;
  border-top:5px solid #333;
}

ul.rounded-tabs li {
  display: inline-block;
  background: #ccc;
  margin: 0 40px;
  padding: 0.625rem 2rem;
  position: relative;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  cursor: pointer;
}

ul.rounded-tabs li:after,
ul.rounded-tabs li:before {
  content: '';
  height: 20px;
  width: 20px;
  background: #ccc;
  position: absolute;
  top: 0;
  right: -20px;
  z-index: 1;
}

ul.rounded-tabs li:before {
  right: auto;
  left: -20px;
}

ul.rounded-tabs li span:after,
ul.rounded-tabs li span:before {
  content: '';
  height: 40px;
  width: 40px;
  background: #fff;
  position: absolute;
  top: 0;
  right: -40px;
  z-index: 2;
  border-radius: 50%;
}

ul.rounded-tabs li span:before {
  right: auto;
  left: -40px;
}
<ul class="rounded-tabs">
  <li><span>Tab1</span></li>
  <li><span>Tab2</span></li>
  <li><span>Tab3</span></li>
</ul>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sumit Patel