Home >Web Front-end >CSS Tutorial >How Do I Create a Circular Menu with Icons Using Pure CSS?
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.
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'>
The CSS styles are crucial for positioning, styling, and animating the menu. The most important properties and their values are:
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; }
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!