I want to create this shape using CSS but cannot get the top right corner to work.
enter image description here
this is all the code that I have.
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 {
content: '';
height: 20px;
width: 20px;
background: #ccc;
position: absolute;
top: 0;
right: -20px;
z-index: 1;
}
ul.rounded-tabs li span:after {
content: '';
height: 40px;
width: 40px;
background:transparent;
position: absolute;
top: 0;
right: -40px;
z-index: 2;
border-radius: 50%;
}
2
Answers
You need to use css
:after
Pseudo-element withbox-shadow
.You can also do this with
clip-path
and apath()
shape instead, which I find a little more straight forward than border and shadow tricks (although YMMV as paths don’t reliably support percentage measurements and calc so this may be less flexible). Here’s a rough example: