I want to create a effect as below with CSS, initially, I was thinking to merge two rectangle with rounded corner, but I can't use that way since it is a sharp angle, not rounded, look at the area in cirle, this is most hard part.
So I do it this way:
1. Create a rounded rectangle as the outline. with border color gray.
2. Create a tringle with gray color at the center of the left side of the rect.
3. Create another triangle with white color to cover the gray triangle in step 2, with a little offset, to make it appears as the border of the rect.
Here is the effect:
My question is:
1. How can I add the right part? it seems I can only draw one shap at the same time in CSS selector :before or :after.
2. What if i want to add border shadow effect? the white triangle will appear if I add shadow of the rect, it's ugly.
3. Or any other way to make this effect?
Here is the code:
.triangle_left {
width: 600px;
height: 600px;
position: relative;
margin: 20px auto;
border: 2px solid #cccccc;
/* box-shadow: 0px 0px 8px 1px darkgrey; */
border-radius: 20px;
}
.triangle_left:before {
content: '';
width: 0;
height: 0;
border: 20px solid transparent;
border-left-color: #cccccc;
position: absolute;
left: 0;
top: 50%;
margin-top: -20px;
}
.triangle_left:after {
content: '';
width: 0;
height: 0;
border: 18px solid transparent;
border-left-color: white;
position: absolute;
left: -2px;
top: 50%;
margin-top: -18px;
}
<div class="triangle_left">
</div>