gpt4 book ai didi

css - 如何使用 css 制作这样的带 Angular 标签?

转载 作者:技术小花猫 更新时间:2023-10-29 10:17:36 24 4
gpt4 key购买 nike

我需要这样做。纯 css 可行吗?

enter image description here

最佳答案

使用 border-radius:beforetransform: skew(...);

body {
background-color: #000;
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 16px;
}
.tab {
height: 50px;
width: 150px;
border-radius: 15px 15px 0px 0px;
background-color: #FFF;
position: relative;
top: 10px;
left: 1px;
display: inline-block;
z-index: 2;
}
.tab:before {
height: 50px;
width: 70px;
border-radius: 10px 10px 0px 0px;
background-color: white;
content: "";
position: absolute;
left: 104px;
top: 0px;
-webkit-transform: skewX(40deg);
transform: skewX(40deg);
z-index: -1;
}
.tab:nth-of-type(2) {
background-color: #555;
top: 10px;
left: 30px;
z-index: 1;
color: #EEE;
}
.tab:nth-of-type(2):before {
background-color: #555;
}
.tab:nth-of-type(2):hover,
.tab:nth-of-type(2):hover:before {
background-color: #159;
transition: 0.3s ease-out;
}
span {
display: inline-block;
width: 160px;
text-align: center;
height: 50px;
line-height: 50px;
z-index: 3;
}
#page {
background-color: white;
height: calc(100vh - 120px);
width: calc(100vw - 61px);
position: relative;
top: 10px;
left: 1px;
padding: 30px;
}
<nav id="tabs">
<div class="tab">
<span>Tab 1</span>
</div>
<div class="tab">
<span>Tab 2</span>
</div>
</nav>
<div id="page">
Lorem Ipsum dolor sit amet ...
</div>

关于css - 如何使用 css 制作这样的带 Angular 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8895273/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com