Table of Contents
How to Create a Radial Menu in CSS
Overview
HTML Structure
CSS Styles
Code Snippet
Conclusion
Home Web Front-end CSS Tutorial How Do I Create a Circular Menu with Icons Using Pure CSS?

How Do I Create a Circular Menu with Icons Using Pure CSS?

Nov 10, 2024 pm 05:54 PM

How Do I Create a Circular Menu with Icons Using Pure CSS?

How to Create a Radial Menu in CSS

Overview

This article will provide a step-by-step guide on creating a circular menu with icons using pure CSS. The goal is to avoid using images or JavaScript for improved performance and accessibility.

HTML Structure

The HTML structure for the radial menu is relatively simple. It consists of an input checkbox to toggle the visibility of the menu, a label for the checkbox, and an unordered list containing the menu items as list elements:

<input type='checkbox'>
Copy after login

CSS Styles

The CSS styles are crucial for positioning, styling, and animating the menu. The most important properties and their values are:

  • Transform: Used to rotate, scale, and skew elements to create the radial layout.
  • Transition: Sets the duration and timing function for the smooth appearance and disappearance of the menu.
  • Border-radius: Creates the rounded corners for the menu items.
  • Box-shadow: Adds depth and dimension to the menu elements.
  • Position: Ensures the menu is centered on the screen.

Code Snippet

input {
  transform: translate(-100vw);
  visibility: hidden;
}

input:checked ~ ul {
  transform: scale(1);
  opacity: 0.999;
  transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

label, ul, li {
  position: absolute;
  left: 50%;
  bottom: 50%;
}

label {
  transform: translate(-50%, -50%);
  margin: -1em;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  box-shadow: 0 0 1px 1px white, 0 0.125em 0.25em #876366,  0 0.125em 0.5em #876366;
  background: #d3d3d3;
  background: radial-gradient(#d4c7c5, #e5e1dd);
  cursor: pointer;
}

ul {
  transform: translate(-50%, -50%) scale(0.001);
  transform-origin: 50% 0%;
  will-change: transform;
  opacity: 0.001;
  transition: 0.5s cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

li {
  overflow: hidden;
  width: 16em;
  height: 16em;
  transform-origin: 0 100%;
}

a {
  display: block;
  transform: rotate(7.5deg)  scaleX(3.8637) skewY(75deg);
  line-height: 3em;
  text-align: center;
  text-decoration: none;
}
Copy after login

Conclusion

This CSS-based radial menu offers a visually appealing and user-friendly way to organize and access options. By carefully crafting the CSS, the menu can be tailored to match the overall design and functionality of the website or application.

The above is the detailed content of How Do I Create a Circular Menu with Icons Using Pure CSS?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Adding Box Shadows to WordPress Blocks and Elements Adding Box Shadows to WordPress Blocks and Elements Mar 09, 2025 pm 12:53 PM

Adding Box Shadows to WordPress Blocks and Elements

Create a JavaScript Contact Form With the Smart Forms Framework Create a JavaScript Contact Form With the Smart Forms Framework Mar 07, 2025 am 11:33 AM

Create a JavaScript Contact Form With the Smart Forms Framework

Create an Inline Text Editor With the contentEditable Attribute Create an Inline Text Editor With the contentEditable Attribute Mar 02, 2025 am 09:03 AM

Create an Inline Text Editor With the contentEditable Attribute

Making Your First Custom Svelte Transition Making Your First Custom Svelte Transition Mar 15, 2025 am 11:08 AM

Making Your First Custom Svelte Transition

Working With GraphQL Caching Working With GraphQL Caching Mar 19, 2025 am 09:36 AM

Working With GraphQL Caching

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts) Comparing the 5 Best PHP Form Builders (And 3 Free Scripts) Mar 04, 2025 am 10:22 AM

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)

File Upload With Multer in Node.js and Express File Upload With Multer in Node.js and Express Mar 02, 2025 am 09:15 AM

File Upload With Multer in Node.js and Express

Show, Don't Tell Show, Don't Tell Mar 16, 2025 am 11:49 AM

Show, Don't Tell

See all articles