I saw the following website:
Photo:
I was wondering how I create something similar to this? The rainbow effect really got me and I’ve been looking for the past 30 minutes but couldn’t find anything. I basically want circles surrounding from the bottom of the page.
3
Answers
You can do it with a combination of
background: radial-gradient
andposition: relative
for the parent andposition: absolute
for the children and then, usingleft
andtop
you can position your icons wherever you want. If you use percentages, then it will work on a variety of screens.If you are looking for pure CSS solutions, then as @cornonthecob recommended the best way would be the gradients approach with hard color stops.
See the snippet below for a sample implementation.
Following discussions in the comments, I can see you want to add things directly into each part of the rainbow, and also maintain responsiveness.
So (despite what I said before in the comments, although those solutions would work fine in lots of cases) I would recommend in your scenario to actually use
position:static
elements and noradial-gradients
or absolute positions, but instead to useborder-radius
andbox-shadow
to achieve this.border-radius
in this case makes the top curvy like a rainbow is, andbox-shadow
fills the gaps that would be in-between the elements normally. I’ve used CSS custom properties to make it neater.https://codepen.io/cornonthecob/pen/mdadvgB
Note that if you want it to look more rainbow-shaped, you should change the border-radius values for each element to perfect the shape, however this is only something you can really do in your actual project once you’ve adapted this solution to your needs.