Using CSS Animations to Add Flair to Your Radial Menu Design

A radial CSS menu is a type of circular menu that consists of a set of menu items positioned along the circumference of a circle or arc. When the user hovers over or clicks on the menu button, the menu items expand radially from the center of the circle, creating a visually striking and interactive user experience.

The theory behind a radial CSS menu is rooted in principles of good user interface design. Radial menus are popular because they:

  • Conserve screen space: By using a circular layout, radial menus allow designers to pack a lot of functionality into a small area, making them ideal for mobile and tablet devices with limited screen real estate.
  • Provide visual hierarchy: By positioning menu items along the circumference of a circle or arc, designers can create a clear visual hierarchy that makes it easy for users to quickly find and select the option they want.

  • Encourage exploration: Because radial menus are visually engaging and fun to interact with, users are more likely to explore all the available options, rather than just selecting the first item they see.
  • Offer a unique user experience: Radial menus are still relatively uncommon, so using one can help your website or app stand out from the crowd and create a memorable user experience.

Source Code

HTML:


<nav class="circular-menu">

  <div class="circle">
    <a href="" class="fa fa-home fa-2x"></a>
    <a href="" class="fa fa-facebook fa-2x"></a>
    <a href="" class="fa fa-twitter fa-2x"></a>
    <a href="" class="fa fa-linkedin fa-2x"></a>
    <a href="" class="fa fa-github fa-2x"></a>
    <a href="" class="fa fa-rss fa-2x"></a>
    <a href="" class="fa fa-pinterest fa-2x"></a>
    <a href="" class="fa fa-asterisk fa-2x"></a>
  </div>
  
  <a href="" class="menu-button fa fa-bars fa-2x"></a>

</nav>

CSS that you need to include:


//not needed if you load it locally in your document HEAD
@import "https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css";

body {
  background: #85c130;
}

.circular-menu {
  width: 250px;
  height: 250px;
  margin: 0 auto;
  position: relative;
}

.circle {
  width: 250px;
  height: 250px;
  opacity: 0;
  
  transform: scale(0);

  transition: all 0.4s ease-out;
}

.open.circle {
  opacity: 1;

  transform: scale(1);
}

.circle a {
  text-decoration: none;
  color: white;
  display: block;
  height: 40px;
  width: 40px;
  line-height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  position: absolute;
  text-align: center;

}

.circle a:hover {
  color: #eef;
}

.menu-button {
  position: absolute;
  top: calc(50% - 30px);
  left: calc(50% - 30px);
  text-decoration: none;
  text-align: center;
  color: #444;
  border-radius: 50%;
  display: block;
  height: 40px;
  width: 40px;
  line-height: 40px;
  padding: 10px;
  background: #dde;
}

.menu-button:hover {
  background-color: #eef;
}

/* Author stuff */
h1.author {
  text-align:center;
  color: white;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 300;
}

h1.author a {
  color: #348;
  text-decoration:none;
}

h1.author a:hover {
  color: #ddd;
} 

JavaScript to include  in the page HEAD



var items = document.querySelectorAll('.circle a');

for(var i = 0, l = items.length; i < l; i++) {
  items[i].style.left = (50 - 35*Math.cos(-0.5 * Math.PI - 2*(1/l)*i*Math.PI)).toFixed(4) + "%";
  
  items[i].style.top = (50 + 35*Math.sin(-0.5 * Math.PI - 2*(1/l)*i*Math.PI)).toFixed(4) + "%";
}

document.querySelector('.menu-button').onclick = function(e) {
   e.preventDefault(); document.querySelector('.circle').classList.toggle('open');
}

Pro Tip: When designing a radial CSS menu it's important to consider factors such as menu item placement, size, and typography, as well as how the menu will behave on different devices and screen sizes, by keeping these considerations in mind and using best practices for radial menu design, you can create a visually striking and intuitive interface that enhances the overall user experience.

And this is what you should see when you press the hamburger menu:

Radial CSS Menu Responsive