Я бы рассмотрел радиальный градиент и только один элемент, как показано ниже.В основном это 4 одинаковых градиента, каждый из которых создает четверть круга, и вы корректируете порядок, чтобы получить окончательную форму:
.box {
width:100px;
height:150px;
background:
radial-gradient(circle at bottom left, transparent 40%,blue 40%, blue 60%,transparent 61%) top,
radial-gradient(circle at bottom right,transparent 40%,green 40%, green 60%,transparent 61%) top,
radial-gradient(circle at top right, transparent 40%,green 40%, green 60%,transparent 61%) bottom,
radial-gradient(circle at top left, transparent 40%,blue 40%, blue 60%,transparent 61%) bottom;
background-size:100% 50%;
background-repeat:no-repeat;
}
<div class="box">
</div>
С двумя элементами вы можете рассмотреть оба псевдоэлемента каждого элемента div, чтобы создать тот же образ, что и первый код, тогда все, что вам нужно сделать, это настроить z-index
.
.box {
width:100px;
height:100px;
position:relative;
}
.box > div {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}
.box > div:before,
.box > div:after {
content:"";
position:absolute;
width:70%;
height:50%;
}
.box > div:first-child {
color:red;
}
.box > div:last-child {
color:blue;
}
.box > div:first-child::before {
z-index:1;
top:0;
left:0;
border-top:15px solid;
border-right:15px solid;
border-top-right-radius:100%;
}
.box > div:first-child::after {
bottom:0;
left:0;
border-bottom:15px solid;
border-right:15px solid;
border-bottom-right-radius:100%;
}
.box > div:last-child::before {
top:0;
right:0;
border-top:15px solid;
border-left:15px solid;
border-top-left-radius:100%;
}
.box > div:last-child::after {
bottom:0;
right:0;
border-bottom:15px solid;
border-left:15px solid;
border-bottom-left-radius:100%;
}
*,*::before,*::after {
box-sizing:border-box;
}
<div class="box">
<div></div>
<div></div>
</div>