<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 4 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 4 年前。
我需要使元素包装器 flex 。 我不提供代码,因为我不明白如何用 css 来创建这样的效果,我应该使用伪元素还是如何以其他方式做到这一点? 所以它应该是这样的
最佳答案
只需将任何 div 的顶部或底部 flex 即可:
div{
border-bottom-left-radius:50%;
border-bottom-right-radius:50%;
}
对于凹面你可以使用伪元素。 HTML:
<div class="div1">
<div class="div3"></div>
</div>
CSS:
.div1 .div3 {
position: relative;
background: #c0c0c0;
height: 200px;
}
.div1 .div3::after {
box-shadow: 0px 0px 0px 100px #c0c0c0;
border-radius: 50%;
position: absolute;
height: 500px; /* increase height to increase the curvature */
content: '';
right: -40%;
left: -40%;
bottom: 100%;
top: auto;
}
关于html - 使用CSS使元素 flex ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54063743/