html - 具有插入曲线和透明背景的 CSS 形状

标签 html css svg css-shapes

我需要创建一个像这张图片一样的 CSS 形状..

enter image description here

请检查这个fiddle我的工作 我已经创建了类似的东西,但我不能给它一个曲线。

#shape {     
    border-left: 70px solid transparent;
    border-top: 100px solid red;
    height: 0;
    width: 200px;
} 

谁能帮帮我?

最佳答案

您可以使用带有 border-radius 和 background-shadows 的伪元素来创建曲线并为曲线启用透明背景

输出:

CSS Shape with thransparent inset curve

#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>

demo

关于html - 具有插入曲线和透明背景的 CSS 形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24696892/

相关文章:

html - 在表格行上交替背景颜色的最佳实践

php - htaccess "breaks"包含 HTTP 451 的参数

javascript - 使用 DomSanitizer 绕过安全性后,安全值必须使用 [property]=binding

html - 具有任意列数且无需换行的网格容器

javascript - 从javascript修改div的数据 donut 属性

javascript - 如何创造条件缓解?

javascript - 如何设置kendogrid组列的宽度

javascript - 将 css "display:none"值替换为“显示 :flex using js

jquery - 在不使用 $.GET 的情况下在 HTML 中内联 SVG

javascript - 给定 d3 中的 1 个图表,由 1 个文件提供 + 想要绘制 X 个图表给定 X 文件数组 + d3