-1

Sample image

I would like to archive this kind of shape using CSS.

#wave {
  position: absolute;
  height: 50%;
  width: inherit;
  background: #e0efe3;
}

<div id="wave"></div>
9
  • Please provide some more representative html and css. Make it as easy a possible for us to help you by proving a reasonable attempt Commented Feb 14, 2021 at 21:27
  • I added an image @JonP please Commented Feb 14, 2021 at 21:29
  • What i wanted is my page to have two waves like those in the picture filled the whole page, I can do the fill but the shape is my problem Commented Feb 14, 2021 at 21:30
  • What have you tried so far? Commented Feb 14, 2021 at 21:36
  • Whats on the code @AHaworth Commented Feb 14, 2021 at 21:39

1 Answer 1

2

You can achieve it using border-radius, relative positioning a little CSS gradient and some z-index.

HTML

<div class="topdiv">Top Content</div>
<div class="overlapdiv"></div>
<div class="bottomdiv">Bottom Content</div>

CSS

div {
  width: 500px;
  min-height: 200px;
  position: relative;
}
.topdiv {
  background-color: #911bc9;
  border-radius: 0 0 0 100px;
  z-index: 2;
}
.overlapdiv {
  top: -100px;
  background: linear-gradient(90deg,rgba(168, 57, 224, 1) 0%,rgba(168, 57, 224, 1) 50%,rgba(145, 27, 201, 1) 50%,rgba(145, 27, 201, 1) 100%);
}
.bottomdiv {
  background-color: #a839e0;
  z-index: 1;
  border-radius: 0 100px 0 0;
  top: -200px;
}

DEMO

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

2 Comments

I wanted it to fit screen, so i added some java-script to control responsiveness, it worked. thanks.
Awesome!, you could make it fit using just width:100%; for all the divs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.