div+css实现大气简洁侧边栏图标导航菜单点击效果代码
代码语言:html
所属分类:菜单导航
代码描述:div+css实现大气简洁侧边栏图标导航菜单点击效果代码
代码标签: div css 大气 简洁 侧边栏 图标 导航 菜单 点击
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" > <style> @import url('https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } :root { --clr: #14161e; } body { min-height: 100vh; background: var(--clr); } .sidebar { position: absolute; width: 80px; height: 100vh; background: #fff; transition: 0.5s; padding-left: 10px; overflow: hidden; } .sidebar.active { width: 300px; } .sidebar ul { position: relative; height: 100vh; } .sidebar ul li { position: relative; list-style: none; } .sidebar ul li.active { background: var(--clr); border-top-left-radius: 50px; border-bottom-left-radius: 50px; } .sidebar ul li.active::before { content: ''; position: absolute; top: -20px; right: 0; width: 20px; height: 20px; border-bottom-right-radius: 20px; box-shadow: 5px 5px 0 5px var(--clr); background: transparent; } .sidebar ul li.active::after { content: ''; position: absolute; bottom: -20px; right: 0; width: 20px; height: 20px; border-top-right-radius: 20px; box-shadow: 5px -5px 0 5px var(--clr); background: transparent; } .sidebar ul li.logo { margin-bottom: 50px; } .sidebar ul li.logo .icon { font-size: 2em; color: var(--clr); } .sidebar ul li.logo .text { font-size: 1.2em; font-weight: 500; color: var(--clr); } .sidebar ul li a { position: relative; display: flex; white-space: nowrap; text-decoration: none; } .sidebar ul li a .icon { position: relative; display: flex; justify-content: center; align-items: center; min-width: 60px; padding-left: 10px; height: 70px; font-size: 1.5em; color: #333; transition: 0.5s; } .sidebar ul li a .text { position: relative; height: 70px; display: flex; align-items: center; font-size: 1em; color: #333; padding-left: 15px; text-transform: uppercase; letter-spacing: 0.05em; transition: 0.5s; } .sidebar ul li.active a .icon { color: #fff; } .sidebar ul li.active a .text { color: var(--bg); } .sidebar ul li:hover a .icon, .sidebar ul li:hover a .text { color: var(--bg); } .sidebar ul li.active a .icon::before { content: ''; position: absolute; inset: 5px; width: 60px; background: var(--bg); border-radius: 50%; transition: 0.5s; } .sidebar ul li:hover.active a .icon::before { background: #fff; } .buttom {.........完整代码请登录后点击上方下载按钮下载查看
网友评论0