CSS圆环菜单是一种基于CSS实现的圆形布局的导航菜单。它通常由多个菜单项组成,这些菜单项围绕一个中心点排列,形成一个环形结构。用户可以通过点击或触摸来选择不同的菜单项。
以下是一个简单的CSS圆环菜单的示例代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Circle Menu</title>
<style>
.circle-menu {
position: relative;
width: 200px;
height: 200px;
}
.circle-menu ul {
list-style: none;
padding: 0;
margin: 0;
position: absolute;
width: 100%;
height: 100%;
transform-origin: center;
}
.circle-menu li {
position: absolute;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
border-radius: 50%;
background-color: #3498db;
color: white;
font-size: 14px;
transition: transform 0.3s ease-in-out;
}
.circle-menu li:nth-child(1) {
transform: rotate(0deg) translate(75px) rotate(0deg);
}
.circle-menu li:nth-child(2) {
transform: rotate(45deg) translate(75px) rotate(-45deg);
}
.circle-menu li:nth-child(3) {
transform: rotate(90deg) translate(75px) rotate(-90deg);
}
.circle-menu li:nth-child(4) {
transform: rotate(135deg) translate(75px) rotate(-135deg);
}
.circle-menu li:nth-child(5) {
transform: rotate(180deg) translate(75px) rotate(-180deg);
}
.circle-menu li:nth-child(6) {
transform: rotate(225deg) translate(75px) rotate(-225deg);
}
.circle-menu li:nth-child(7) {
transform: rotate(270deg) translate(75px) rotate(-270deg);
}
.circle-menu li:nth-child(8) {
transform: rotate(315deg) translate(75px) rotate(-315deg);
}
</style>
</head>
<body>
<div class="circle-menu">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
</ul>
</div>
</body>
</html>
通过以上方法,你可以创建一个美观且功能齐全的CSS圆环菜单。
领取专属 10元无门槛券
手把手带您无忧上云