带有插入曲线和透明背景的 CSS 形状 [英] CSS shape with inset curve and transparent background

查看:34
本文介绍了带有插入曲线和透明背景的 CSS 形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

请检查我的作品

I need to create a CSS shape like this image..

Please check this fiddle of my work I have created something like that, but I cannot give a curve to it.

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

Can anyone help me?

解决方案

You can use a pseudo element with border-radius and background-shadows to create the curve and enable a transparent background for the curve.

Output :

#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

这篇关于带有插入曲线和透明背景的 CSS 形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆