here is the shape i want to do enter link description here
P.S.I am still learning the front-end stuff so could you pls help me with this assignment.
Here is the HTML code <div>Elzero</div>
here is the CSS code i tried to do with
* {
box-sizing: border-box;
}
div {
width: 200px;
height: 200px;
background-color: #eee;
margin: 80px auto;
color: black;
font-size: 50px;
font-weight: bold;
text-align: center;
line-height: 200px;
border-radius: 50%;
}
::after {
content: "";
width: 200px;
height: 200px;
background-color: #03a9f4;
margin: 80px auto;
border-radius: 50%;
position: absolute;
transform: translate(-190px, -80px);
z-index: -1;
}
::before {
content: "";
width: 200px;
height: 200px;
background-color: #e91e63;
margin: 80px auto;
border-radius: 50%;
position: absolute;
top: 0px;
z-index: -2;
}
div:hover {
transition: all 0.5s;
transform: rotate(180deg);
}
As you are constrained to use just one div, this snippet builds on your idea of having the pseudo elements but creating them with conic-gradient backgrounds and the 'main' div having the light gray circular background created using a radial gradient. That way it creates these 3 shapes.
and overlays them to give the impression of 3/4 circles. It then uses CSS animation to rotate them on hover.
Obviously you will want to play with the dimensions, the animations timings and directions to get exactly what you want but this should give a start.
* {
box-sizing: border-box;
}
div {
width: 200px;
height: 200px;
background-image: radial-gradient(#eee 0 55%, transparent 55% 100%);
margin: 80px auto;
color: black;
font-size: 50px;
font-weight: bold;
text-align: center;
line-height: 200px;
border-radius: 50%;
position: relative;
}
div::after {
content: "";
width: 200px;
height: 200px;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
z-index: -2;
background-image: conic-gradient(#03a9f4 0deg 45deg, white 45deg 135deg, #03a9f4 135deg 360deg);
}
div::before {
content: "";
width: calc(100% - 10%);
height: calc(100% - 10%);
position: absolute;
border-radius: 50%;
position: absolute;
top: 5%;
left: 5%;
z-index: -1;
background-image: conic-gradient(#e91e63 0, #e91e63 225deg, white 225deg, white 315deg, #e91e63 315deg, #e91e63 360deg);
}
div:hover::after {
animation: rot .4s linear;
}
div:hover::before {
animation: rot .4s linear;
animation-delay: .1s;
animation-direction: reverse;
}
#keyframes rot {
0% {
transform: rotate(0);
}
25% {
transform: rotate(180deg);
}
50% {
transform: rotate(180deg);
}
75% {
transform: rotate(0);
}
100% {}
}
<div>Elzero
</div>
also here is example in less:
https://codepen.io/nikitahl/pen/XooBXd
if you want to use css here is a converter:
https://jsonformatter.org/less-to-css
I am trying to create a pure CSS design of a sphere revolving(orbiting) around another sphere. Like a moon orbiting the sun to be precise. The image of the earth fits in properly into the sphere of earth. But the image of moon does not fit into the sphere of moon.
The image attached might help to understand my question better
Below is my CSS script
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
border-radius: 50%;
background: transparent;
}
.center .earth {
position: absolute;
top: 0;
width: 200px;
height: 200px;
background-image: url(https://www.publicdomainpictures.net/pictures/90000/velka/earth-map.jpg);
margin: 3em auto;
border-radius: 50%;
background-size: 630px;
animation: spin 30s linear alternate infinite;
box-shadow: inset 20px 0 80px 6px rgba(0, 0, 0, 1);
color: #000;``
}
.center .earth .moon {
position: absolute;
top: calc(50% - 1px);
left: 50%;
width: 200px;
height: 2px;
transform-origin: left;
border-radius: 50%;
/*animation: rotate 10s linear infinite;*/
}
.center .earth .moon::before {
content: url(moon.jpg);
position: absolute;
top: -25px;
right: 0;
width: 50px;
height: 50px;
background: #fff;
border-radius: 50%;
/*animation: rotate 10s linear infinite;*/
}
#keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#keyframes spin {
100% {
background-position: 100%;
}
}
Make this change content: "";
to background-image: url(moon.jpg);
and remove background: #fff from classname .center .earth .moon::before
body {
background: black;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
border-radius: 50%;
background: transparent;
}
.center .earth {
position: absolute;
top: 0;
width: 200px;
height: 200px;
background-image: url(https://www.publicdomainpictures.net/pictures/90000/velka/earth-map.jpg);
margin: 3em auto;
border-radius: 50%;
background-size: 630px;
animation: spin 30s linear alternate infinite;
box-shadow: inset 20px 0 80px 6px rgba(0, 0, 0, 1);
color: #000;``
}
.center .earth .moon {
position: absolute;
top: calc(50% - 1px);
left: 50%;
width: 200px;
height: 2px;
transform-origin: left;
border-radius: 50%;
/*animation: rotate 10s linear infinite;*/
}
.center .earth .moon::before {
content: "";
background-image: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRsvjrANMGI8aBJSFbsHteVa04rcB1IjjNsbrhm8vTLflfpiG133g);
position: absolute;
top: -25px;
right: 0;
width: 50px;
height: 50px;
border-radius: 50%;
/*animation: rotate 10s linear infinite;*/
}
#keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#keyframes spin {
100% {
background-position: 100%;
}
}
<div class="center">
<div class="earth">
<div class="moon">
</div>
</div>
</div>
I have an oval, and inside the oval, I have a strip that I need it to have waves
I have made this:
.strip {
content: "";
position: relative;
background: #4286f4;
z-index: 1;
width: 100%;
height: 100%;
bottom: 0%;
animation: wipe 8s cubic-bezier(0.9, 0.7, 0.8, 0.8) forwards;
animation-iteration-count: infinite;
}
#keyframes wipe {
from {
bottom: 0%;
}
to {
bottom: 100%;
}
}
.oval {
position: absolute;
background: #343434;
-moz-border-radius: 0 50% / 0 100%;
-webkit-border-radius: 0 50% / 0 100%;
border-radius: 150px;
height: 100px;
width: 80%;
overflow: hidden;
}
<div class="oval">
<div class="strip"></div>
</div>
How can i make that my strip have infinite wave animation?
You can try some repeated radial-gradient over a linear-graident to create the waves. Then you can simply animate the background-position and you can get rid of one DOM element.
#keyframes wipe {
from {
background-position:0 85px,0 120px;
}
to {
background-position:100px -45px,100px -20px;
}
}
.oval {
border-radius: 150px;
height: 100px;
width: 80%;
overflow: hidden;
background:
radial-gradient(circle at center,#4286f4 67%,transparent 67.5%)0 5px /50px 50px repeat-x,
linear-gradient(#343434,#343434)0 30px/100% 150% repeat-x;
background-color: #4286f4;
animation: wipe 8s cubic-bezier(0.9, 0.7, 0.8, 0.8) forwards;
animation-iteration-count: infinite;
}
<div class="oval">
</div>
If I understand correctly you want the wave to go up and down?
You can specify percentages instead of from and to as keyframes-selector
.strip {
content: "";
position: relative;
background: #4286f4;
z-index: 1;
width: 100%;
height: 100%;
bottom: 0%;
animation: wipe 8s cubic-bezier(0.9, 0.7, 0.8, 0.8) forwards;
animation-iteration-count: infinite;
}
#keyframes wipe {
0% {
bottom: 0%;
}
50% {
bottom: 100%;
}
100% {
bottom: 0%;
}
}
.oval {
position: absolute;
background: #343434;
-moz-border-radius: 0 50% / 0 100%;
-webkit-border-radius: 0 50% / 0 100%;
border-radius: 150px;
height: 100px;
width: 80%;
overflow: hidden;
}
<div class="oval">
<div class="strip"></div>
</div>
Question [Resolved]: How do I rotate the background image of a circle?
Link: https://codepen.io/Refath/pen/XaoMEj
Hi, I'm trying to rotate the background image of a circle element the opposite direction, but at the same magnitude of rotation, so that the background remains straight relative to the user. I've tried to use css keyframes, but realized this would not be the best idea, and then tried to implement the solution given [here][1], also failing after some tweaks. Thanks; Any help is appreciated (I'm not an advanced web developer, so I don't have much experience with JS, etc.)
#import url('https://fonts.googleapis.com/css?family=Quicksand:500');
body {
background-image: url(http://1.bp.blogspot.com/-cynjeO46IAM/UBUmNk0NnxI/AAAAAAAAAqg/jpqpb_LMn6U/s1600/tR2hW.jpg);
}
.circle,
.r1c,
.r2c,
.r3c,
.r4c {
border: white 2px solid;
width: 90px;
height: 90px;
border-radius: 90px;
fill: lightred;
position: absolute;
margin: auto;
background-size: 100px 100px;
background-repeat: no-repeat;
background-position: -5px -5px;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
transition: 0.1s ease-in-out;
}
.circle {
background-image: url(https://media.giphy.com/media/Ry0QlB6DwmCZO/giphy.gif);
background-position: -9px -9px;
}
.r1c:hover,
.r2c:hover,
.r3c:hover,
.r4c:hover {
width: 108px;
height: 108px;
border-radius: 108px;
transition: 0.3s ease-in;
background-size: 120px 120px;
background-position: -5.4px -5.4px;
}
.r1c {
position: relative;
overflow: hidden;
top: 200px;
background-image: url("http://icons.iconarchive.com/icons/xenatt/the-circle/512/App-Google-icon.png");
}
.r2c {
top: -400px;
background-image: url(https://www.shareicon.net/data/512x512/2015/09/30/109354_media_512x512.png);
}
.r3c {
left: 400px;
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/2000px-F_icon.svg.png);
}
.r4c {
right: 400px;
background-image: url("https://lh3.googleusercontent.com/mIeBLLu8xOi-1bPbtRO_HYb5d1VchJDLDH4hebMO7R-GNOfueGDtHCKgPWFjwyCAORQ=w300");
}
.r1l,
.r2l,
.r3l,
.r4l {
border: white 1px solid;
width: 0px;
height: 90px;
border-radius: 90px;
fill: lightred;
position: absolute;
margin: auto;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}
.r1l {
top: 200px;
}
.r2l {
top: -200px;
}
.r3l {
width: 90px;
height: 0px;
left: 200px;
}
.r4l {
width: 90px;
height: 0px;
left: -200px;
}
.parent {
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
animation: around 7.5s infinite ease;
}
#keyframes around {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(90deg);
}
25% {
transform: rotate(90deg);
}
50% {
transform: rotate(180deg);
}
50% {
transform: rotate(180deg);
}
75% {
transform: rotate(270deg);
}
75% {
transform: rotate(270deg);
}
100% {
transform: rotate(360deg);
}
}
.hero {
color: white;
font-family: 'Quicksand', sans-serif;
}
<center>
<h1 class="hero">Hi, User!</h1>
</center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div class="parent">
<div class="circle">
</div>
<a href="https://www.google.com">
<div class="r1c">
</div>
</a>
<div class="r2c">
</div>
<div class="r3c">
</div>
<div class="r4c">
</div>
<div class="r1l">
</div>
<div class="r2l">
</div>
<div class="r3l">
</div>
<div class="r4l">
</div>
</div>
Do you want something like this :
#import url('https://fonts.googleapis.com/css?family=Quicksand:500');
body{
background-color:black;
}
img{
position:relative;
width:100%;
height:100%;
animation: around 6.5s infinite ease;
animation-direction:reverse
}
.circle, .r1c, .r2c, .r3c, .r4c{
border: white 2px solid;
width: 90px;
height: 90px;
border-radius: 90px;
fill: lightred;
position: absolute;
margin: auto;
background-size: 100px 100px;
background-repeat: no-repeat;
background-position: -5px -5px;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
transition: 0.1s ease-in-out;
}
.circle{
background-image: url(https://media.giphy.com/media/Ry0QlB6DwmCZO/giphy.gif);
background-position: -9px -9px;
}
.r1c:hover, .r2c:hover, .r3c:hover, .r4c:hover{
width:108px;
height: 108px;
border-radius:108px;
transition: 0.3s ease-in;
background-size: 120px 120px;
background-position: -5.4px -5.4px;
}
.r1c{
position: relative;
overflow: hidden;
top: 310px;
background-image: url("http://icons.iconarchive.com/icons/xenatt/the-circle/512/App-Google-icon.png");
}
.r2c{
top: -400px;
background-image: url(https://www.shareicon.net/data/512x512/2015/09/30/109354_media_512x512.png);
}
.r3c{
left: 400px;
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/2000px-F_icon.svg.png);
}
.r4c{
right: 400px;
background-image: url("https://lh3.googleusercontent.com/mIeBLLu8xOi-1bPbtRO_HYb5d1VchJDLDH4hebMO7R-GNOfueGDtHCKgPWFjwyCAORQ=w300");
}
.r1l, .r2l, .r3l, .r4l{
border: white 1px solid;
width: 0px;
height: 90px;
border-radius: 90px;
fill: lightred;
position: absolute;
margin: auto;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}
.r1l{
top: 200px;
}
.r2l{
top: -200px;
}
.r3l{
width: 90px;
height: 0px;
left: 200px;
}
.r4l{
width: 90px;
height: 0px;
left: -200px;
}
.parent {
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
position:absolute;
animation: around 7.5s infinite ease;
}
#keyframes around{
0% {transform: rotate(0deg);}
25% {transform: rotate(90deg);}
25% {transform: rotate(90deg);}
50% {transform: rotate(180deg);}
50% {transform: rotate(180deg);}
75% {transform: rotate(270deg);}
75% {transform: rotate(270deg);}
100% {transform: rotate(360deg);}
}
.hero{
color:white;
font-family: 'Quicksand', sans-serif;
}
<img src='http://1.bp.blogspot.com/-cynjeO46IAM/UBUmNk0NnxI/AAAAAAAAAqg/jpqpb_LMn6U/s1600/tR2hW.jpg'/>
<center> <h1 class = "hero">Hi, User!</h1></center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div class = "parent">
<div class = "circle">
</div>
<a href = "https://www.google.com"><div class = "r1c">
</div></a>
<div class = "r2c">
</div>
<div class = "r3c">
</div>
<div class = "r4c">
</div>
<div class = "r1l">
</div>
<div class = "r2l">
</div>
<div class = "r3l">
</div>
<div class = "r4l">
</div>
</div>
I want to create a rainbow using only CSS only. Below is an image of what is required.
Here is my code (so far):
* {
margin: 0;
padding: 0;
}
#r {
height: 80vw;
width: 80vw;
background-color: #f00;
position: absolute;
z-index: 1;
}
#o {
height: 76vw;
width: 76vw;
background-color: #fe6230;
position: absolute;
top: 2vw;
left: 2vw;
z-index: 2;
}
#y {
height: 72vw;
width: 72vw;
background-color: #fef600;
position: absolute;
top: 4vw;
left: 4vw;
z-index: 3;
}
#g {
height: 68vw;
width: 68vw;
background-color: #00bc00;
position: absolute;
top: 6vw;
left: 6vw;
z-index: 4;
}
#b {
height: 64vw;
width: 64vw;
background-color: #0048fe;
position: absolute;
top: 8vw;
left: 8vw;
z-index: 5;
}
#i {
height: 60vw;
width: 60vw;
background-color: #000083;
position: absolute;
top: 10vw;
left: 10vw;
z-index: 6;
}
#v {
height: 56vw;
width: 56vw;
background-color: #30009b;
position: absolute;
top: 12vw;
left: 12vw;
z-index: 7;
}
<div id="r">
</div>
<div id="o">
</div>
<div id="y">
</div>
<div id="g">
</div>
<div id="b">
</div>
<div id="i">
</div>
<div id="v">
</div>
The problem with my code is that I am unable to curve it (like in a real rainbow). I also need to hide half of this rainbow.
This could be done using a single div element with a :pseudo-element and box-shadow.
div {
position: relative;
width: 300px;
height: 150px;
background: white;
overflow: hidden;
transform: scale(2);
margin-left: 130px;
margin-top: -50px;
}
div:after {
position: absolute;
content: '';
width: 100px;
height: 100px;
top: 100px;
left: 50px;
border-radius: 50%;
box-shadow: 0 0 0 5px #4200AB, 0 0 0 10px #000095, 0 0 0 15px #00ABFF, 0 0 0 20px #00C800, 0 0 0 25px #FFF800, 0 0 0 30px #FF7642, 0 0 0 35px #E40000;
}
<div></div>
Example using vh / vw units.
Demo on CodePen
Looks awful in the snippet here because of the viewport ratio, better viewed on CodePen.
div {
position: relative;
width: 95vw;
height: 45vw;
overflow: hidden;
background: transparent;
transform: translate(-50vw, -16.666vw);
top: 8vw;
left: 50vw;
}
div:after {
position: absolute;
content: '';
width: 50%;
height: 100%;
top: 25vw;
left: 25vw;
border-radius: 50%;
box-shadow: 0 0 0 2vw #4200AB, 0 0 0 4vw #000095, 0 0 0 6vw #00ABFF, 0 0 0 8vw #00C800, 0 0 0 10vw #FFF800, 0 0 0 12vw #FF7642, 0 0 0 14vw #E40000;
}
body {
margin: 0;
}
<div></div>
Here is a slightly different approach using radial-gradient. The approach is pretty much self explanatory as the gradient background is applied in an elliptical manner with multiple color stops (one for each color + white at the beginning and end).
Note: The browser support is much better for box-shadow than it is for radial-gradients and hence the answer posted by chipChocolate.py is probably the best for now.
This one can also support vw/vh units and can adapt the appearance accordingly.
.rainbow {
height: 25vw;
width: 50vw;
background: -webkit-radial-gradient(50% 110%, ellipse, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
background: -moz-radial-gradient(50% 110%, ellipse, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
background: radial-gradient(ellipse at 50% 110%, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
}
<div class="rainbow"></div>
I thought i'd add just some of the rainbow designs found while going through codepen for your inspiration (note I did not make these, it's more for reference than anything)
option 1
#import "http://fonts.googleapis.com/css?family=Racing+Sans+One";
#-moz-keyframes spin {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
#-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
#keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#rainbow {
height: 290px;
overflow: hidden;
margin: 0 auto;
position: relative;
width: 580px;
-moz-transition: height 500ms ease-in-out;
-webkit-transition: height 500ms ease-in-out;
transition: height 500ms ease-in-out;
}
#rainbow.reveal {
height: 600px;
}
#rainbow li {
position: absolute;
height: 100%;
text-indent: -9999px;
opacity: 0.8;
}
#rainbow .ribbon {
border-radius: 50%;
border-style: solid;
border-width: 40px;
position: absolute;
left: inherit;
top: inherit;
-moz-animation: spin;
-moz-animation-duration: 2s;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-direction: alternate;
-moz-animation-fill-mode: forwards;
-webkit-animation: spin;
-webkit-animation-duration: 2s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-fill-mode: forwards;
animation: spin;
animation-duration: 2s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-fill-mode: forwards;
}
#rainbow .red {
left: 0;
top: 0;
}
#rainbow .red .ribbon {
border-color: red;
height: 500px;
width: 500px;
clip: rect(0px, 580px, 290px, 0px);
-moz-animation-delay: 0s;
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
#rainbow .orange {
left: 20px;
top: 20px;
}
#rainbow .orange .ribbon {
border-color: orange;
height: 420px;
width: 420px;
clip: rect(0px, 500px, 250px, 0px);
-moz-animation-delay: 1s;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
#rainbow .yellow {
left: 40px;
top: 40px;
}
#rainbow .yellow .ribbon {
border-color: yellow;
height: 340px;
width: 340px;
clip: rect(0px, 420px, 210px, 0px);
-moz-animation-delay: 2s;
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
#rainbow .green {
left: 60px;
top: 60px;
}
#rainbow .green .ribbon {
border-color: green;
height: 260px;
width: 260px;
clip: rect(0px, 340px, 170px, 0px);
-moz-animation-delay: 3s;
-webkit-animation-delay: 3s;
animation-delay: 3s;
}
#rainbow .blue {
left: 80px;
top: 80px;
}
#rainbow .blue .ribbon {
border-color: blue;
height: 180px;
width: 180px;
clip: rect(0px, 260px, 130px, 0px);
-moz-animation-delay: 4s;
-webkit-animation-delay: 4s;
animation-delay: 4s;
}
#rainbow .indigo {
left: 100px;
top: 100px;
}
#rainbow .indigo .ribbon {
border-color: indigo;
height: 100px;
width: 100px;
clip: rect(0px, 180px, 90px, 0px);
-moz-animation-delay: 5s;
-webkit-animation-delay: 5s;
animation-delay: 5s;
}
#rainbow .violet {
left: 120px;
top: 120px;
}
#rainbow .violet .ribbon {
border-color: violet;
height: 20px;
width: 20px;
clip: rect(0px, 100px, 50px, 0px);
-moz-animation-delay: 6s;
-webkit-animation-delay: 6s;
animation-delay: 6s;
}
.cta {
cursor: pointer;
color: #622AF0;
font-family: 'Racing Sans One', cursive;
font-size: 18px;
display: block;
text-align: center;
margin-bottom: 5px;
}
body {
background: #DFFAFF;
}
<ul id="rainbow">
<li class="red">
<strong class="ribbon">Red</strong>
</li>
<li class="orange">
<strong class="ribbon">Orange</strong>
</li>
<li class="yellow">
<strong class="ribbon">Yellow</strong>
</li>
<li class="green">
<strong class="ribbon">Green</strong>
</li>
<li class="blue">
<strong class="ribbon">Blue</strong>
</li>
<li class="indigo">
<strong class="ribbon">Indigo</strong>
</li>
<li class="violet">
<strong class="ribbon">Violet</strong>
</li>
</ul>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
option 2
body {
background-color: #A7BACB;
margin: 0;
padding: 0;
}
html {
position: relative;
height: 100%;
background: #F9FEFF;
}
.rainbow {
width: 500px;
height: 240px;
margin: 20% auto 0 auto;
position: absolute;
left: 50%;
margin-left: -250px;
bottom:0;
}
.rainbow p {
text-indent: -9000px;
margin: 0;
position: absolute;
bottom: 0;
width: 100%;
-webkit-border-top-left-radius: 600px 560px;
-webkit-border-top-right-radius: 600px 560px;
-moz-border-radius-topleft: 600px 560px;
-moz-border-radius-topright: 600px 560px;
}
.rainbow p:nth-child(1),
.rainbow .r {
background-color: #FF0000; /* red */
height: 240px;
width: 500px;
}
.rainbow p:nth-child(2),
.rainbow .o {
background-color: #FF9900; /* orange */
height: 220px;
width: 460px;
left: 20px;
}
.rainbow p:nth-child(3),
.rainbow .y {
background-color: #FFFF00; /* yellow */
height: 200px;
width: 420px;
left: 40px;
}
.rainbow p:nth-child(4),
.rainbow .g {
background-color: #2ECE0C;/* green */
height: 180px;
width: 380px;
left: 60px;
}
.rainbow p:nth-child(5),
.rainbow .b {
background-color: #0000FF; /* blue */
height: 160px;
width: 340px;
left: 80px;
}
.rainbow p:nth-child(6),
.rainbow .i {
background-color: #6600FF; /* indigo */
height: 140px;
width: 300px;
left: 100px;
}
.rainbow p:nth-child(7),
.rainbow .v {
background-color: #8B00FF; /* violet */
height: 120px;
width: 260px;
left: 120px;
}
.rainbow p:nth-last-of-type(1),
.rainbow p:last-child {
background-color: #F9FEFF;
height: 100px;
width: 220px;
left: 140px;
}
<div class="rainbow">
<p class="r">red</p>
<p class="o">orange</p>
<p class="y">yellow</p>
<p class="g">green</p>
<p class="b">blue</p>
<p class="i">indigo</p>
<p class="v">violet</p>
<p>the end</p>
</div>
option 3 (box shadow idea)
div {
width: 50%;
margin: 40px auto;
text-align: center;
}
.rainbow {
background-color: #000;
display: block;
font-family: Georgia;
font-size: 14px;
padding: 80px;
margin-top: 160px;
border-radius: 80px;
box-shadow:
0 0 0 20px violet,
0 0 0 40px indigo,
0 0 0 60px blue,
0 0 0 80px green,
0 0 0 100px yellow,
0 0 0 120px orange,
0 0 0 140px red;
width: 0;
}
<div>
<a class="rainbow"></a>
</div>
option 4 (using border colors)
body{
background: #9ecdef;
}
.rainbow {
width: 600px;
height: 300px;
overflow: hidden;
position: absolute;
top: calc(50% - 150px);
left: calc(50% - 300px);
}
.border{
border-style: solid;
border-width: 10px;
border-left-color: transparent;
border-bottom-color: transparent;
border-radius: 50%;
}
.red {
width: calc(100% - 20px);
height: calc(200% - 20px);
border-top-color: #f00;
border-right-color: #f00;
animation: rotate 2s ease-in-out;
-webkit-animation: rotate 2s ease-in-out;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.size{
width: calc(100% - 20px);
height: calc(100% - 20px);
}
.orange{
border-top-color: #ff4500;
border-right-color: #ff4500;
}
.yellow{
border-top-color: #ff0;
border-right-color: #ff0;
}
.green{
border-top-color: #0f0;
border-right-color: #0f0;
}
.blue{
border-top-color: #00f;
border-right-color: #00f;
}
.cyan{
border-top-color: #0ff;
border-right-color: #0ff;
}
.purple{
border-top-color: #8a2be2;
border-right-color: #8a2be2;
}
#keyframes rotate {
from{-webkit-transform: rotate(-225deg);}
to{-webkit-transform: rotate(-45deg);}
}
#-webkit-keyframes rotate {
from{-webkit-transform: rotate(-225deg);}
to{-webkit-transform: rotate(-45deg);}
}
<div class="rainbow">
<div class="red border">
<div class="orange border size">
<div class="yellow border size">
<div class="green border size">
<div class="blue border size">
<div class="cyan border size">
<div class="purple border size">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>