JSFiddle - React, Tailwind, and code Playground
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Segmented Circular Hamburger Menu</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: #f0f0f0;
font-family: Arial, sans-serif;
overflow: hidden; /* Prevents scrollbars from appearing due to overflow */
}
/* Centered circular hamburger menu button */
.hamburger-menu {
position: absolute;
z-index: 3; /* Ensures the button stays on top */
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 60px;
border-radius: 50%;
background-color: #333;
color: white;
cursor: pointer;
font-size: 24px;
}
/* Circular menu container */
.menu {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 300px;
margin-top: -150px; /* Half of menu height to center it */
margin-left: -150px; /* Half of menu width to center it */
border-radius: 50%;
display: none;
align-items: center;
justify-content: center;
z-index: 2;
overflow: hidden;
}
/* Positioning menu items in a segmented circle */
.menu .segment {
position: absolute;
width: 100%;
height: 100%;
clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%);
overflow: hidden;
transform-origin: center center;
}
.menu .segment a {
display: flex;
align-items: center;
justify-content:...