1

I was trying to create a div like this:

enter image description here

I came up with a solution using SVGs, which is

div {
  width: 100px;
}
<div>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="450 0 50 150">
          <path id = "zone1" d="M450,150 v-50 q12.5 -10, 25, 0 t25 0 v50 z" fill="gray"></path>
  </svg>
</div>

But is there any way to do this by just using CSS?

6
  • Why not like svg? Commented Jul 27, 2020 at 4:05
  • 1
    Nothing against SVG, just figuring out if it is even possible or not. Got any ideas? Commented Jul 27, 2020 at 4:16
  • there is an example. Should I throw it off in the comments, or in the solution of the issue? Commented Jul 27, 2020 at 4:22
  • If it is a link share it in the comments or else post in a answer... Commented Jul 27, 2020 at 4:23
  • Blocked my answer, pointing out that it is copy-paste. Yes, it's copy-paste! This is not my decision. I made it known at the very beginning! Commented Jul 27, 2020 at 9:03

1 Answer 1

3

.fill-gray {
  background-color: gray;
}

.semi-circle {
  border-radius: 50%;
  width: 150px;
  height: 80px;
  background-color: green;
  position: absolute;
}

.semi-circle-1 {
  top: -25px;
  left: 0px;
  background-color: gray;
}

.semi-circle-2 {
  top: -60px;
  left: 135px;
  background-color: white;
}

.rectangle {
  width: 275px;
  height: 400px;
  position:relative;
  top: 100px;
  border-top-left-radius: 15px;
}
<div class="fill-gray rectangle">
<div class="fill-gray semi-circle semi-circle-1"></div>
<div class="fill-gray semi-circle semi-circle-2"></div>
</div>

Here's a repl.it I made for a solution using positioning in CSS: Make a wave with CSS

Or if you so desire, you could use clip-path like in these solutions: Wavy shape with css

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.