Wavy shape with css

stevenspiel picture stevenspiel · Jun 20, 2013 · Viewed 171.1k times · Source

I'm trying to recreate this image with CSS:

wayvy shape

I would not need it to repeat. This is what I started but it just has a straight line:

Answer

ThomasA picture ThomasA · Feb 17, 2014

I think this is the right way to make a shape like you want. By using the SVG possibilities, and an container to keep the shape responsive.

svg {
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
}
.container {
  display: inline-block;
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  vertical-align: middle;
  overflow: hidden;
}
<div class="container">
  <svg viewBox="0 0 500 500" preserveAspectRatio="xMinYMin meet">
    <path d="M0,100 C150,200 350,0 500,100 L500,00 L0,0 Z" style="stroke: none; fill:red;"></path>
  </svg>
</div>