Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS shape with inset curve and transparent background

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

enter image description here

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?

like image 518
Sameer Sam Avatar asked Jul 11 '14 11:07

Sameer Sam


People also ask

How do I make a background transparent in shape?

Here's how. Select the shape or shapes that you want to make transparent. Right-click, and on the context menu, select Format Shape. In the Format Shape pane, set the Transparency slider to the percentage of transparency that you want.

How do I make a semi transparent background in CSS?

To achieve this, use a color value which has an alpha channel—such as rgba. As with opacity , a value of 1 for the alpha channel value makes the color fully opaque. Therefore background-color: rgba(0,0,0,. 5); will set the background color to 50% opacity.


1 Answers

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 :

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

like image 74
web-tiki Avatar answered Sep 22 '22 00:09

web-tiki