Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wavy shape with css

Tags:

css

css-shapes

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:

#wave {    position: absolute;    height: 70px;    width: 600px;    background: #e0efe3;  }
<div id="wave"></div>
like image 228
stevenspiel Avatar asked Jun 19 '13 22:06

stevenspiel


People also ask

How do you make a wave shape in CSS?

One of the easiest ways to add waves to an element is the ShapeDriver tool. It allows you to create a wave effect generating an SVG path and required CSS code to style it. To add more complex layered waves, you can use the Haikei app to randomly generate a variety of beautiful waves, blobs, and other shapes.

How do you make a wavy line in HTML?

In order to form wavy text, you first use a combination of elements from CSS. In the tag'span class', we insert the 'body' part and create it. A wavy text is created by using CSS code to describe a portion of the HTML structure referred to as “the body”.

What are waves in HTML?

Waves are simple designs that can be generated on an HTML page which enhances the overall look of the website and make it more attractive and designer.


2 Answers

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>
like image 54
ThomasA Avatar answered Oct 02 '22 19:10

ThomasA


I'm not sure it's your shape but it's close - you can play with the values:

https://jsfiddle.net/7fjSc/9/

#wave {    position: relative;    height: 70px;    width: 600px;    background: #e0efe3;  }  #wave:before {    content: "";    display: block;    position: absolute;    border-radius: 100% 50%;    width: 340px;    height: 80px;    background-color: white;    right: -5px;    top: 40px;  }  #wave:after {    content: "";    display: block;    position: absolute;    border-radius: 100% 50%;    width: 300px;    height: 70px;    background-color: #e0efe3;    left: 0;    top: 27px;  }
<div id="wave"></div>
like image 25
Kamran Asgari Avatar answered Oct 02 '22 19:10

Kamran Asgari