您好,我正在寻找最有效的方法来创建带有圆 Angular 的 HTML/CSS 的“选项卡”,同时还要平滑、圆 Angular 地过渡到底部。
我想出了一个解决方案,在选项卡两侧使用两个具有 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;
}
我想知道是否有更好/更好的方法来实现这一目标。
最佳答案
使用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/