答案 0 :(得分:2)
您可以将:after
伪元素用于蓝色部分,并在父级上设置overflow: hidden
。
.el {
width: 40%;
height: 300px;
background: #B5B5B5;
position: relative;
overflow: hidden;
}
.el:after {
content: '';
background: #48B2FF;
height: 150%;
width: 200%;
border-radius: 50%;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -70%);
}

<div class="el"></div>
&#13;
答案 1 :(得分:2)
这是我的方法:
#background {
width: 100vw;
height: 100vh;
background: tomato;
overflow: hidden;
position: fixed;
}
#background::before {
content: "";
display: block;
width: 200vw;
height: 200vw;
border-radius: 50%;
background: green;
position: absolute;
bottom: 50vh;
left: 50%;
transform: translateX(-50%);
}
#wrapper {
position: relative;
color: #fff;
text-align: center;
}
<div id="background"></div>
<div id="wrapper">Some content above the background element</div>