我需要创建一个像这张图片一样的 CSS 形状..
请检查这个fiddle我的工作 我已经创建了类似的东西,但我不能给它一个曲线。
#shape {
border-left: 70px solid transparent;
border-top: 100px solid red;
height: 0;
width: 200px;
}
谁能帮帮我?
最佳答案
您可以使用带有 border-radius 和 background-shadows 的伪元素来创建曲线并为曲线启用透明背景。
输出:
#shape {
width: 300px; height: 100px;
position: relative;
overflow: hidden;
}
#shape:before {
content: '';
position: absolute;
top: 10%; right: 0;
width: 300%;
padding-bottom: 300%;
border-radius: 100%;
background: none;
box-shadow: 10px -10px 5px 300px #F15723;
z-index: -1;
}
body{background:url(https://farm9.staticflickr.com/8461/8048823381_0fbc2d8efb.jpg);background-size:cover;}
<div id="shape"></div>
关于html - 具有插入曲线和透明背景的 CSS 形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24696892/