The Orb Tutorial aka Tutorbial

In my recent shrine I used pure css to make my buttons look like bubbles/orbs. This is a tutorial of how I achieved the effect incase someone wants something similar for their own site. It took me far too long to figure out how to get this how I have it so hopefully this helps at least one like minded web-designer and/or myself of the future. NOTE: This is just how I did it. I am by no means a CSS expert. OK? Yay!

Pre-game: Decide what color(s) you want your orb to be. You will only need one color to base your entire orb on. For this tutorial I am using #a2b1f8


1. The Base

In your html add the following code to your html body:



Everything else will be done in your css.

To begin we define #Orb-Wrapper's size and background color. This is our container for the orb. This is important in this example because the orb is semi-transparent. If your container/body's {background-color} is lighter than your orb color or your background gradient doesn't fade to transparent (#ffffff00), you can skip this entirely.



We then define the orb itself "#Orb". This can be anything you want but for this tutorial I am using 150px ratio and 50% border-radius for a perfect circle. Feel free to play around with the shape here!! The most important part is the background linear gradient, which sets the color and transparency of our orb.

2. Pseudo Elements


::before and ::after pseudo elements in css insert content before and after an element. In the case of #Orb we want to add a shine at the top (::before) and a shine from the bottom (::after).

First I will make a circle slightly smaller than my base, position it at the top, and give it a white to transparent gradient.



Then I will do the same with the ::after element but positioning it at the bottom and reversing the direction of the gradient.

Finito!

Your finished css should look like this:



Orbxample:

Using % in our size and positioning allows us to be able to easily scale this to any size. Though you may have to play around with the blur and opacity depending on how big/small you make yours! I hope this helps someone! Happy designing!

You can also put content in it! 😜