html - 具有圆形底座的 CSS 选项卡(平滑底座过渡)

标签 html css tabs rounded-corners

您好,我正在寻找最有效的方法来创建带有圆 Angular 的 HTML/CSS 的“选项卡”,同时还要平滑、圆 Angular 地过渡到底部。

示例:enter image description here

我想出了一个解决方案,在选项卡两侧使用两个具有 CSS 渐变的元素

.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;
}

查看我的solution on Codepen

我想知道是否有更好/更好的方法来实现这一目标。

最佳答案

使用css psuedo elelmts 来实现相同的效果,

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>

关于html - 具有圆形底座的 CSS 选项卡(平滑底座过渡),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57215029/

相关文章:

html - 即使我使用元视口(viewport),网站 View 也很小

html - div中文本的奇怪填充/边距

html - 当用户将鼠标悬停在我们显示按钮的 div 上时,键盘访问不适用于带有按钮的内部 div。如何实现无障碍?

vim - 像缓冲区一样使用 Vim 的选项卡

angular - 如何在 ionic 中更改选项卡时弹出所有选项卡堆栈?

firefox - 在 Firefox 中导出同步选项卡

html - UC Mini 浏览器中的网站布局不完美,为什么?

css - 具有 3 个随机大小列和底部的 div 模板

javascript - 如何缩放背景图像并使其与浏览器大小一起使用

javascript - 从我的 javascript 代码更改 div 样式