Sharwar Aman Symon
Sharwar Aman Symon

Reputation: 39

CSS curve wave background

I am a new learner of html and css. I want to make my circle orange background curve wave using only css not using background-image or svg. Like the screenshot:

https://i.sstatic.net/rDQeY.png enter image description here

Without using background image curve just css in (.circle-inner). But I am failed to making this. I am tried a lot. I upload my html and css code.

My html and css code:

.circle-inner {
    width: 310px;
    height: 310px;
	background-color:#d1132f;
	background-repeat:no-repeat;
    margin: 0 auto;
    border-radius: 100%;
	border: 1px solid #ff8403;
	display:table;
	position: relative;
    z-index: 1;
    overflow: hidden;
}

.circle-points {
    display:  table-cell;
    vertical-align:  middle;
    margin:  0 auto;
    text-align:  center;
	color: #fff;
}
.circle-points h2 {
    margin:  0;
    font-size: 68px;
}

.circle-points span {
    display:  block;
    font-size: 26px;
}

/* if circle reset */
.circle-inner:after {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0px;
    content: '';
    z-index: -1;
	
    background: #ffc815; /* Old browsers */
    background: -moz-linear-gradient(left, #ffc815 0%, #ff7e01 100%); /* FF3.6-15 */
    background: -webkit-linear-gradient(left, #ffc815 0%,#ff7e01 100%); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(to right, #ffc815 0%,#ff7e01 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffc815', endColorstr='#ff7e01',GradientType=1 ); /* IE6-9 */    	
}

/* if point 1 */
.circle-inner:after {
    /* background-color:orange; */
    top: 60%;    	
}
<div class="circle-area">
    <div class="circle-inner">
        <div class="circle-points">
            <h2>1</h2><span>Point</span>
        </div>    					
    </div>
</div>

Upvotes: 3

Views: 13073

Answers (3)

Jonny
Jonny

Reputation: 1329

I used Div Containers and CSS to reproduce your required results. Feel free to tweak as you need. First i made a div container with a border or 50% on all sides for our circle. Next i built 2 more divs with a border radius and gradient and rotated them to place to create the results. Hope it helps.

.circleContainer{
width:400px;
height:400px;
border-radius:50%;
background-color:#ffcc33;
margin-left:30%;
margin-top:5%;
position:absolute;
overflow:hidden;
transform:rotate(17deg);
}
.splitA{
width:100%;
height:40%;
float:left;
background-color:#cc0066;
}
.curveOne{
width:100%;
position:absolute;
height:60%;
float:left;
transform:rotate(-50deg);
margin-left:-13%;
margin-top:-7%;
border-bottom-left-radius:60%;
border-top-left-radius:0%;
background: linear-gradient(to bottom, red,  #cc0066); 
}
.curveTwo{
width:100%;
position:absolute;
height:60%;
float:left;
margin-left:20%;
margin-top:45%;
transform:rotate(-50deg);
border-bottom-right-radius:0%;
border-top-right-radius:40%;
background: linear-gradient(to top, #cc6600, #ff9933, #ffcc33); 
}
<div class="circleContainer">
<div class="splitA"><div class="curveOne"></div></div>
<div class="curveTwo"></div>
</div>

Upvotes: 8

Saravana
Saravana

Reputation: 3496

Try this.

#yin-yang {
  display: flex;
  align-items: center;
  width: 80vmin;
  height: 80vmin;
  border-radius: 50%;
  background: linear-gradient(black 50%, #3ed89c 0);
}
#yin-yang:before, #yin-yang:after {
  flex: 1;
  height: 50%;
  border-radius: 50%;
  background: black;
  content: "";
}
#yin-yang:after {	
  background: #3ed89c;
}
<div id="yin-yang"></div>

Upvotes: 2

pixlboy
pixlboy

Reputation: 1502

Have a look at the example below.

You can take help of SVG Cubic Bezier curves to create complex shapes. You need to specify three sets of coordinates.

C x1 y1, x2 y2, x y (or c dx1 dy1, dx2 dy2, dx dy)

Check this link: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths

<svg width="190" height="160" xmlns="http://www.w3.org/2000/svg">
  <path d="M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80" stroke="black" fill="transparent"/>
</svg>

Upvotes: 1

Related Questions